/* ===================================
   Dashboard Styles
   =================================== */

.dashboard-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    background: var(--secondary-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
}

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

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    padding: 8px 24px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: var(--transition);
}

.nav-item:hover {
    background: rgba(34, 197, 94, 0.08);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(34, 197, 94, 0.12);
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

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

.logout-btn {
    color: #ef4444 !important;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1) !important;
}

/* Main Content */
.dashboard-main {
    margin-left: 280px;
    min-height: 100vh;
    background: var(--dark-bg);
    width: calc(100% - 280px);
    box-sizing: border-box;
}

/* Advertiser dashboard home — single-column layout (sidebar is fixed) */
body.dashboard-home .dashboard-layout {
    display: block;
    min-height: 100vh;
}

body.dashboard-home .dashboard-main {
    margin-left: 280px;
    width: calc(100% - 280px);
    max-width: calc(100% - 280px);
    min-height: 100vh;
    background: #eef1f6 !important;
    display: flex;
    flex-direction: column;
}

body.dashboard-home .sidebar {
    overflow-x: hidden;
    overflow-y: auto;
}

body.dashboard-home .dashboard-header {
    position: fixed;
}

.dashboard-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: rgba(11, 23, 39, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-left: auto;
}

.header-balance {
    display: flex;
    align-items: center;
    gap: 12px;
}

.balance-amount {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.header-user {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.header-user:hover {
    background: rgba(15, 23, 42, 0.6);
}

.user-avatar {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border-radius: 50%;
    color: #fff;
}

.user-name {
    font-weight: 500;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--dark-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 0;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
}

.header-user:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.user-dropdown a:hover {
    background: rgba(34, 197, 94, 0.08);
    color: var(--text-primary);
}

.user-dropdown .logout-link {
    color: #ef4444;
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
    padding-top: 12px;
}

.project-selector-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.project-selector {
    min-width: 160px;
    max-width: 200px;
    padding: 6px 12px;
    font-size: 0.85rem;
}

.nav-user-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-right: 8px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Dashboard Content */
.dashboard-content {
    padding: 32px;
}

.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 1.75rem;
    margin-bottom: 8px;
}

.page-header p {
    color: var(--text-secondary);
    margin: 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

.dashboard-content .stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: var(--dark-card-soft);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.stat-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 1.5rem;
    color: #fff;
}

.stat-icon.bg-primary { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-icon.bg-success { background: var(--gradient-primary); }
.stat-icon.bg-warning { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-icon.bg-info { background: linear-gradient(135deg, #06b6d4, #0891b2); }

.stat-info h3 {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.stat-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Quick Actions */
.quick-actions {
    margin-bottom: 40px;
}

.quick-actions h2 {
    font-size: 1.25rem;
    margin-bottom: 20px;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px;
    background: var(--dark-card-soft);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    transition: var(--transition);
}

.action-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
}

.action-card i {
    font-size: 1.75rem;
    color: var(--primary-color);
}

.action-card span {
    font-weight: 500;
}

/* Recent Activity */
.recent-activity {
    background: var(--dark-card-soft);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.recent-activity .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.recent-activity .section-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.recent-activity .section-header a {
    color: var(--primary-color);
    font-size: 0.9rem;
}

.activity-list {
    min-height: 100px;
}

.activity-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-secondary);
}

.activity-empty i {
    font-size: 2.5rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Modal Styles */
.modal-lg {
    max-width: 700px;
}

.text-gold {
    color: #f59e0b;
}

.payment-summary {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    margin: 24px 0;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.summary-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.summary-row.bonus {
    color: #f59e0b;
}

.summary-row.total {
    font-size: 1.1rem;
    font-weight: 700;
    padding-top: 16px;
    margin-top: 8px;
    border-top: 2px solid var(--border-color);
}

.form-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

/* Responsive */
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .actions-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 992px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    body.dashboard-home .dashboard-layout {
        display: block;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-close {
        display: block;
    }
    
    .dashboard-main,
    body.dashboard-home .dashboard-main {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .dashboard-content {
        padding: 24px 16px;
    }
}

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: 1fr; }
    .actions-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .header-balance .balance-amount { display: none; }
}

/* Collapsible sidebar groups — scoped to sidebar only */
.sidebar .nav-group { margin-bottom: 4px; }

.sidebar .nav-group-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: var(--transition);
}

.sidebar .nav-group-toggle:hover {
    background: rgba(34, 197, 94, 0.08);
    color: var(--text-primary);
}

.sidebar .nav-group-toggle .nav-chevron {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.sidebar .nav-group.open .nav-chevron { transform: rotate(180deg); }

.sidebar .nav-group-items { display: none; padding-left: 12px; }
.sidebar .nav-group.open .nav-group-items { display: block; }

.sidebar .nav-sub {
    padding-left: 36px !important;
    font-size: 0.85rem !important;
}

.sidebar .nav-sub.active {
    color: var(--primary-color);
    background: rgba(34, 197, 94, 0.1);
}

.sidebar .nav-group-toggle.active-group,
.sidebar .nav-group.open .nav-group-toggle.nav-group-affiliate {
    color: var(--primary-color);
}

.sidebar .nav-group.open .nav-group-toggle.nav-group-affiliate i.fa-filter {
    color: var(--primary-color);
}

.sidebar .nav-add-funds:hover {
    color: var(--primary-color);
}