/* ============================================
   Dashboard — Partner Cabinet Styles
   ============================================ */

/* Auth Overlay */
.auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 40px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

.auth-form h3 {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
    text-align: center;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 14px;
    transition: var(--transition);
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

.form-group input::placeholder { color: var(--text-muted); }
.form-group select { appearance: none; cursor: pointer; }
.form-group select option { background: var(--bg-primary); color: var(--text-primary); }

.auth-error {
    color: var(--accent-3);
    font-size: 13px;
    margin-bottom: 12px;
    min-height: 18px;
}

.auth-switch {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 16px;
}

.auth-switch a { color: var(--accent-2); font-weight: 600; }

.auth-back {
    display: block;
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-muted) !important;
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.dash-sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary) !important;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 4px;
    position: relative;
}

.sidebar-link:hover {
    background: var(--glass-bg);
    color: var(--text-primary) !important;
}

.sidebar-link.active {
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.15), rgba(0, 217, 255, 0.08));
    color: var(--accent-2) !important;
    font-weight: 600;
}

.sl-icon { font-size: 18px; }

.sl-badge {
    position: absolute;
    right: 12px;
    padding: 2px 8px;
    border-radius: 50px;
    background: var(--accent-3);
    color: white;
    font-size: 11px;
    font-weight: 700;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--glass-border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
    flex-shrink: 0;
}

.sidebar-user-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
}

.sidebar-user-email {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

.sidebar-logout {
    width: 100%;
    padding: 8px;
    border-radius: var(--radius-sm);
    background: rgba(255, 107, 157, 0.1);
    border: 1px solid rgba(255, 107, 157, 0.15);
    color: var(--accent-3);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.sidebar-logout:hover { background: rgba(255, 107, 157, 0.2); }

/* Mobile header */
.dash-mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--glass-border);
    align-items: center;
    justify-content: space-between;
}

.mobile-menu-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

/* Main content */
.dash-main {
    flex: 1;
    margin-left: 260px;
    padding: 32px;
    min-height: 100vh;
}

.dash-page {
    display: none;
    animation: fadeIn 0.3s ease;
}
.dash-page.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h2 {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 800;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 14px;
    width: 100%;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-card:hover { transform: translateY(-2px); }

.sc-icon { font-size: 32px; }

.sc-value {
    display: block;
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 800;
}

.sc-label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
}

.sc-highlight {
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.1), rgba(0, 217, 255, 0.05)) !important;
}

.sc-highlight .sc-value {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Ref link card */
.ref-link-card {
    padding: 32px;
    margin-bottom: 32px;
}

.ref-link-card h3 {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.ref-link-card > p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.ref-link-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.ref-link-row input {
    flex: 1;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--accent-2);
    font-family: monospace;
    font-size: 14px;
}

.ref-share-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.share-btn {
    padding: 8px 20px;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.share-tg:hover { background: #229ED9; color: white; border-color: #229ED9; }
.share-wa:hover { background: #25D366; color: white; border-color: #25D366; }
.share-vk:hover { background: #4C75A3; color: white; border-color: #4C75A3; }

/* Info grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.info-card {
    padding: 24px;
}

.info-card h4 { font-size: 14px; margin-bottom: 8px; }
.info-card p { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }

/* Referral tabs & list */
.ref-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.ref-tab {
    padding: 10px 24px;
    border-radius: var(--radius-lg);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.ref-tab.active {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
}

.referral-item {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.ri-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
    flex-shrink: 0;
}

.ri-info { flex: 1; }
.ri-name { font-weight: 600; font-size: 14px; }
.ri-email { font-size: 12px; color: var(--text-muted); }
.ri-date { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* Earnings */
.earnings-summary {
    display: flex;
    gap: 32px;
    padding: 24px 32px;
    margin-bottom: 24px;
}

.es-label { font-size: 13px; color: var(--text-muted); display: block; }
.es-value { font-family: var(--font-display); font-size: 28px; font-weight: 800; display: block; }
.es-pending { color: var(--accent-3); }

.earning-item {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ei-info {}
.ei-desc { font-size: 14px; font-weight: 500; }
.ei-meta { font-size: 12px; color: var(--text-muted); }
.ei-amount { font-family: var(--font-display); font-weight: 700; color: var(--accent-4); font-size: 16px; }

/* Materials */
.materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

.material-card {
    padding: 24px;
}

.material-card h4 { font-size: 16px; margin-bottom: 12px; }

.material-text {
    padding: 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    border: 1px solid var(--glass-border);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 12px;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

/* Notifications */
.notif-item {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    margin-bottom: 8px;
    display: flex;
    gap: 12px;
}

.notif-item.unread {
    border-color: rgba(108, 99, 255, 0.2);
    background: rgba(108, 99, 255, 0.05);
}

.notif-icon { font-size: 20px; flex-shrink: 0; }
.notif-info { flex: 1; }
.notif-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.notif-msg { font-size: 13px; color: var(--text-secondary); }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* Profile */
.profile-form {
    padding: 32px;
    max-width: 500px;
}

.profile-form h3 {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
}

.profile-msg {
    margin-top: 12px;
    font-size: 13px;
    min-height: 18px;
}

.profile-msg.success { color: var(--accent-4); }
.profile-msg.error { color: var(--accent-3); }

/* Empty state */
.empty-state {
    padding: 48px 24px;
    text-align: center;
}

.empty-icon { font-size: 48px; display: block; margin-bottom: 16px; }
.empty-state h4 { font-size: 18px; margin-bottom: 8px; }
.empty-state p { color: var(--text-secondary); font-size: 14px; }

/* Responsive */
@media (max-width: 768px) {
    .dash-sidebar {
        transform: translateX(-100%);
    }
    .dash-sidebar.open { transform: translateX(0); }

    .dash-mobile-header { display: flex; }

    .dash-main {
        margin-left: 0;
        padding: 80px 16px 24px;
    }

    .stats-grid { grid-template-columns: 1fr 1fr; }
    .ref-link-row { flex-direction: column; }
    .earnings-summary { flex-direction: column; gap: 16px; }
    .page-header h2 { font-size: 22px; }
}

/* Light theme overrides */
[data-theme="light"] .auth-overlay { background: var(--bg-primary); }
[data-theme="light"] .dash-sidebar { background: #fff; }
[data-theme="light"] .dash-mobile-header { background: #fff; }
[data-theme="light"] .form-group input, [data-theme="light"] .form-group select {
    background: rgba(0,0,0,0.03);
    border-color: rgba(0,0,0,0.1);
}
[data-theme="light"] .material-text { background: rgba(0,0,0,0.02); }
[data-theme="light"] .form-group select option { background: #fff; }
