/* Base Styles and Variables */
:root {
    --primary-color: #5988ff;
    --primary-dark: #3366ff;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-800: #1f2937;
}

/* Dashboard Layout Adjustments */
body.page-template-template-affiliate-dashboard {
    background: var(--gray-50) !important;
}

.page-template-template-affiliate-dashboard #page {
    margin: 0 !important;
    padding: 0 !important;
}

.page-template-template-affiliate-dashboard #main {
    padding: 0 !important;
}

.page-template-template-affiliate-dashboard .dashboard-container {
    padding: 15px !important;
    margin: 0 !important;
}

@media (max-width: 768px) {
    .page-template-template-affiliate-dashboard {
        overflow-x: hidden !important;
    }

    .page-template-template-affiliate-dashboard #content {
        padding-top: 0 !important;
    }

    .page-template-template-affiliate-dashboard .middle_content {
        padding: 0 !important;
    }
    
    .page-template-template-affiliate-dashboard #middle {
        padding: 0 !important;
    }

    /* Ensure content is visible immediately after header */
    .page-template-template-affiliate-dashboard .dashboard-container {
        margin-top: 0 !important;
    }
}

/* Dashboard Layout */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Welcome Section */
.welcome-section {
    width: 100%;
    margin-bottom: 30px;
    box-sizing: border-box;
}

.welcome-section::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.welcome-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.welcome-info h1 {
    font-size: 28px;
    margin: 0;
    font-weight: 600;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Main content area */
.dashboard-main {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

.container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
}

/* Affiliate link section adjustment */
.affiliate-link-section {
    width: 100%;
    margin: 0 0 30px 0;
    box-sizing: border-box;
}

/* Analytics section adjustment */
.analytics-section {
    width: 100%;
    margin: 0 0 30px 0;
    box-sizing: border-box;
}

/* Recent activity section adjustment */
.recent-activity {
    width: 100%;
    margin: 0 0 30px 0;
    box-sizing: border-box;
}

/* Bank details section adjustment */
.bank-details-section {
    width: 100%;
    margin: 0 0 30px 0;
    box-sizing: border-box;
}

/* Responsive adjustments */
@media (max-width: 1440px) {
    .dashboard-container {
        max-width: 100%;
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .dashboard-container {
        padding: 10px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.tier-badge {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tier-badge:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.tier-badge i {
    font-size: 18px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    padding: 0;
    width: 100%;
}

.stat-card {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

/* Table Styles - Fixed Mobile Version */
.table-responsive {
    position: relative;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: white;
    margin: 0;
    padding: 0;
}

.activity-table {
    width: 100%;
    min-width: 800px;
    margin: 0;
    padding: 0;
    border-collapse: collapse;
}

/* Base column widths */
.activity-table .date-col { min-width: 100px; }
.activity-table .amount-col { min-width: 150px; }
.activity-table .commission-col { min-width: 150px; }
.activity-table .status-col { min-width: 120px; }
.activity-table .progress-col { min-width: 150px; }
.activity-table .actions-col { min-width: 100px; }

/* Card styles */
.activity-card {
    background: white;
    margin: 0;
    padding: 0;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--gray-200);
}

/* Table header and cell styles */
.activity-table th {
    background: var(--gray-50);
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    white-space: nowrap;
}

.activity-table td {
    padding: 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-200);
    font-size: 14px;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .welcome-section {
        padding: 25px;
        border-radius: 15px;
    }

    .welcome-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .welcome-info h1 {
        font-size: 24px;
    }

    .tier-badge {
        align-self: flex-start;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        padding: 0 15px;
    }

    .stat-card {
        padding: 20px;
    }

    .stat-value {
        font-size: 28px;
    }

    /* Mobile Table Styles */
    .activity-card {
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 0 !important;
    }

    .table-responsive {
        max-width: 100%;
        margin: 0;
        padding: 0;
        border: none;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .activity-table {
        width: 100%;
        min-width: 800px;
        margin: 0;
        padding: 0;
    }

    .activity-table th,
    .activity-table td {
        padding: 12px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* Custom Scrollbar for Mobile */
    .table-responsive::-webkit-scrollbar {
        height: 6px;
    }

    .table-responsive::-webkit-scrollbar-track {
        background: var(--gray-100);
    }

    .table-responsive::-webkit-scrollbar-thumb {
        background: var(--gray-300);
        border-radius: 3px;
    }

    /* Scroll Indicators */
    .table-responsive::before,
    .table-responsive::after {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        width: 15px;
        z-index: 2;
        pointer-events: none;
    }

    .table-responsive::before {
        left: 0;
        background: linear-gradient(to right, rgba(255,255,255,0.9), rgba(255,255,255,0));
    }

    .table-responsive::after {
        right: 0;
        background: linear-gradient(to left, rgba(255,255,255,0.9), rgba(255,255,255,0));
    }

    .card-header {
        padding: 15px;
    }

    .table-footer {
        padding: 10px;
        font-size: 12px;
    }

    /* Hide optional columns on mobile */
    .progress-col {
        display: none;
    }
}

/* Mobile Header Fixes */
@media (max-width: 768px) {
    /* Theme header adjustments */
    .cmsmasters_header_regular .header_mid {
        position: relative !important;
        min-height: auto !important;
        padding: 10px 0 !important;
        background: transparent !important;
    }

    .cmsmasters_header_regular .header_mid .header_mid_inner {
        padding: 0 15px !important;
    }

    .cmsmasters_header_regular .header_mid .logo_wrap {
        max-width: 150px !important;
        margin: 0 !important;
    }

    /* Dashboard container adjustments */
    .dashboard-container {
        padding-top: 0 !important;
        margin-top: 0 !important;
    }

    /* Welcome section adjustments */
    .welcome-section {
        margin-top: 20px !important;
        border-radius: 15px !important;
    }

    /* Adjust other header elements if needed */
    .resp_mid_nav_wrap {
        height: auto !important;
    }

    .resp_mid_nav_wrap .resp_mid_nav {
        padding: 0 !important;
        font-size: 20px !important;
    }

    /* Fix possible navigation menu issues */
    .mid_nav_wrap {
        height: auto !important;
        padding: 0 !important;
    }
}

/* Additional fixes for extra small devices */
@media (max-width: 480px) {
    .cmsmasters_header_regular .header_mid {
        padding: 5px 0 !important;
    }

    .cmsmasters_header_regular .header_mid .logo_wrap {
        max-width: 120px !important;
    }

    .dashboard-container {
        padding: 10px !important;
    }
}

/* Fix header background and positioning */
@media (max-width: 768px) {
    #header {
        position: relative !important;
        min-height: auto !important;
        background: transparent !important;
        margin-bottom: 0 !important;
    }

    #page {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    /* Force any fixed or sticky positioning to be relative */
    .fixed_header #header {
        position: relative !important;
    }

    .fixed_header #middle {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
}

/* Status Badge Styles */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.status-badge.status-pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.status-badge.status-converted {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.status-badge.status-cancelled {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: white;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

/* Date Stack Styling */
.date-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.date-stack .day {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1;
}

.date-stack .month {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 2px 0;
}

.date-stack .time {
    font-size: 12px;
    color: var(--text-muted);
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--gray-100);
    border-radius: 3px;
    overflow: hidden;
}

.progress {
    height: 100%;
    transition: width 0.3s ease;
}

.progress-pending {
    background: var(--warning-color);
}

.progress-converted {
    background: var(--success-color);
}

.progress-cancelled {
    background: var(--danger-color);
}

/* Animation */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card {
    animation: slideUp 0.5s ease forwards;
    animation-delay: calc(var(--card-index) * 0.1s);
}

/* Add these styles in your existing <style> section */

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    padding: 0;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #1f2937;
}

.modal-body {
    padding: 20px;
}

.close {
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
    line-height: 1;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.submit-button {
    width: 100%;
    padding: 12px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.submit-button:hover {
    background: #1d4ed8;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .form-group input {
        font-size: 16px; /* Better for mobile */
    }
}

/* Bank details section responsive fixes */
.bank-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px;
}

.bank-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Additional mobile optimizations */
@media (max-width: 480px) {
    .dashboard-container {
        padding: 10px;
    }
    
    .welcome-section {
        padding: 20px;
    }
    
    .stats-grid {
        padding: 0 10px;
    }
    
    .bank-info-grid {
        padding: 10px;
    }
}