* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-blue: #4A90E2;
    --primary-green: #50C878;
    --dark-bg: #1a1f36;
    --darker-bg: #131829;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --hover-bg: #f8fafc;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    color: var(--text-primary);
    min-height: 100vh;
}

.container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--darker-bg) 0%, var(--dark-bg) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.logo {
    padding: 28px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-green) 100%);
}

.logo h2 {
    font-size: 20px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

nav::-webkit-scrollbar {
    width: 6px;
}

nav::-webkit-scrollbar-track {
    background: transparent;
}

nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.nav-item {
    display: block;
    padding: 14px 24px;
    margin: 4px 12px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 8px;
    font-size: 14.5px;
    font-weight: 500;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-green));
    color: white;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
    font-weight: 600;
}

.sidebar-footer {
    padding: 20px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-logout {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-logout:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: auto;
    background: #f8fafc;
}

.header {
    background: linear-gradient(135deg, var(--card-bg) 0%, #fefefe 100%);
    padding: 24px 32px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
}

.user-info {
    color: #6b7280;
    font-size: 14px;
}

/* Pages */
.page {
    display: none;
    padding: 32px;
}

.page.active {
    display: block;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    padding: 28px;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    display: flex;
    gap: 20px;
    align-items: center;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(74, 144, 226, 0.15);
    border-color: var(--primary-blue);
}

.stat-icon {
    font-size: 36px;
    width: 68px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e0f2fe 0%, #dbeafe 100%);
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.15);
}

.stat-content h3 {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Section Title */
.section-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
    position: relative;
    padding-bottom: 12px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-green));
    border-radius: 2px;
}

/* Table */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 2px solid var(--border-color);
}

th {
    padding: 16px 20px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

td {
    padding: 18px 20px;
    border-top: 1px solid #f1f5f9;
    color: var(--text-primary);
    font-size: 14px;
}

tbody tr {
    transition: all 0.2s ease;
}

tbody tr:hover {
    background: var(--hover-bg);
    transform: scale(1.002);
}

.loading {
    text-align: center;
    color: #94a3b8;
    padding: 40px !important;
}

/* Status Badge */
.status-badge, .badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.status-active, .badge-success {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #065f46;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.status-inactive, .badge-secondary {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #991b1b;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

.status-pending {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}

.status-approved {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #065f46;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.status-rejected {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #991b1b;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

/* Buttons */
.btn, .btn-primary {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-green));
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.btn:hover, .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
    margin-right: 6px;
    border-radius: 6px;
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--error), #dc2626);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.feature-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.feature-info h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.feature-info p {
    font-size: 12px;
    color: #6b7280;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 52px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #3b82f6;
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* Forms */
.commission-form, .notification-form {
    background: white;
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    max-width: 600px;
}

.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.form-group input,
.form-group textarea,
select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus,
.form-group textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.currency {
    position: absolute;
    right: 12px;
    top: 38px;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Filter Bar */
.filter-bar {
    margin-bottom: 24px;
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
}

.filter-bar select {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    background: white;
    font-weight: 500;
    transition: all 0.3s ease;
}

.filter-bar select:hover {
    border-color: var(--primary-blue);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #111827;
}

.close-modal {
    font-size: 28px;
    font-weight: 300;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    color: #374151;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Badge Styles */
.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-secondary {
    background-color: #e5e7eb;
    color: #6b7280;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    margin-right: 4px;
}

.btn-danger {
    background: #EF4444;
    color: white;
}

.btn-danger:hover {
    background: #DC2626;
}

.btn-small:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Form improvements */
.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.form-group small {
    display: block;
    margin-top: 4px;
}

.form-group input[type="color"] {
    height: 40px;
    cursor: pointer;
}

/* KYC Cards Grid */
.kyc-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 20px;
    padding: 20px;
}

.kyc-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    overflow: hidden;
}

.kyc-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.kyc-card-header {
    padding: 20px;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kyc-profile-img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e5e7eb;
    cursor: pointer;
    transition: transform 0.2s;
}

.kyc-profile-img:hover {
    transform: scale(1.1);
    border-color: #3b82f6;
}

.kyc-profile-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e5e7eb, #f3f4f6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.kyc-card-body {
    padding: 20px;
}

.kyc-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
}

.kyc-info-row:last-of-type {
    border-bottom: none;
}

.kyc-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

.kyc-value {
    font-size: 14px;
    color: #111827;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.kyc-rejection-reason {
    margin-top: 12px;
    padding: 12px;
    background: #fef2f2;
    border-left: 3px solid #ef4444;
    border-radius: 6px;
    font-size: 13px;
    color: #991b1b;
}

.kyc-documents {
    margin-top: 16px;
}

.kyc-docs-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.kyc-doc-item {
    aspect-ratio: 1;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    background: #f9fafb;
}

.kyc-doc-item:hover {
    border-color: #3b82f6;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.kyc-doc-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kyc-doc-item span {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 6px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
}

.kyc-doc-missing {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fef2f2;
    border-color: #fecaca;
    cursor: not-allowed;
}

.kyc-doc-missing:hover {
    transform: none;
    border-color: #fecaca;
    box-shadow: none;
}

.kyc-doc-missing span {
    position: static;
    background: transparent;
    color: #991b1b;
    font-size: 12px;
    text-align: center;
    line-height: 1.4;
}

.kyc-card-footer {
    padding: 16px 20px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
}

.btn-kyc {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-approve {
    background: #10b981;
    color: white;
}

.btn-approve:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-reject {
    background: #ef4444;
    color: white;
}

.btn-reject:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Filter Bar */
.filter-bar {
    background: white;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* Document Viewer Modal Improvements */
.modal .modal-content img {
    border: 2px solid #e5e7eb;
    background: white;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

@media (max-width: 1200px) {
    .sidebar {
        width: 240px;
    }
    
    .kyc-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
    
    .header {
        padding: 20px 24px;
    }
    
    .page {
        padding: 24px;
    }
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    table {
        min-width: 800px;
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 70px;
        overflow: visible;
    }
    
    .logo {
        padding: 16px 20px;
    }
    
    .logo h2 {
        font-size: 16px;
    }
    
    nav {
        display: flex;
        overflow-x: auto;
        padding: 0;
        white-space: nowrap;
    }
    
    nav::-webkit-scrollbar {
        height: 4px;
    }
    
    .nav-item {
        display: inline-block;
        padding: 12px 16px;
        margin: 8px 4px;
        font-size: 13px;
    }
    
    .nav-item:hover {
        transform: translateX(0);
    }
    
    .sidebar-footer {
        display: none;
    }
    
    .header {
        padding: 16px 20px;
    }
    
    .header h1 {
        font-size: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .page {
        padding: 16px;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .kyc-cards-grid {
        grid-template-columns: 1fr;
    }
    
    .kyc-card-footer {
        flex-direction: column;
    }
    
    td, th {
        padding: 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 18px;
    }
    
    .user-info {
        display: none;
    }
    
    .stat-card {
        padding: 16px;
        gap: 12px;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 28px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}
