/* ===================================
   Advertiser Dashboard Home (icopify.co style)
   =================================== */

body.dashboard-home {
    --dash-bg: #eef1f6;
    --dash-card: #ffffff;
    --dash-text: #1e293b;
    --dash-muted: #64748b;
    --dash-border: #e2e8f0;
    overflow-x: hidden;
}

body.dashboard-home .dashboard-main {
    background: #eef1f6 !important;
    flex: 1;
    overflow-x: clip; /* clip 不创建 sticky Containing block */
}

body.dashboard-home .dashboard-content {
    color: var(--dash-text);
    padding: 76px 24px 90px;
    flex: 1;
    width: 100%;
    box-sizing: border-box;
    background: #eef1f6;
    position: relative;
    z-index: 1;
}

body.dashboard-home .breadcrumb {
    font-size: 0.9rem;
    color: var(--dash-muted);
    margin-bottom: 20px;
}

/* Top header — fixed to top of main area (right of sidebar) */
body.dashboard-home .dashboard-header {
    background: #ffffff !important;
    backdrop-filter: none;
    border-bottom: 1px solid #e2e8f0;
    padding: 8px 20px;
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-height: 56px;
    height: 56px;
    box-sizing: border-box;
    overflow: visible;
    position: fixed;
    top: 0;
    left: 280px;
    right: 0;
    z-index: 250;
    color: #1e293b;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

body.dashboard-home .dashboard-header > .sidebar-toggle {
    display: none !important;
    margin-right: auto;
}

body.dashboard-home .header-toolbar {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-left: auto;
    flex-wrap: wrap;
}

.header-icon-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    text-decoration: none;
}

.btn-add-funds-gold {
    background: linear-gradient(180deg, #fde047, #facc15);
    color: #1e293b;
    border: none;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    white-space: nowrap;
    flex-shrink: 0;
}

a.btn-add-funds-gold {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

body.dashboard-home .sidebar-footer,
body.publisher-app .sidebar-footer {
    display: none;
}

.header-balance-pills {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.balance-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    flex-shrink: 0;
}

.balance-pill i { color: rgba(255,255,255,0.92); font-size: 0.85rem; }
.balance-pill-blue { background: #3b82f6; }
.balance-pill-cyan { background: #06b6d4; }
.balance-pill-green { background: #22c55e; }

body.dashboard-home .header-user {
    position: relative;
    flex-shrink: 0;
    padding: 0;
}

body.dashboard-home .header-user .user-avatar {
    width: 38px;
    height: 38px;
    background: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    color: #64748b;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.dashboard-home .user-dropdown {
    background: #fff;
    border: 1px solid var(--dash-border);
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    border-radius: 8px;
    padding: 6px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: 0.2s ease;
    z-index: 300;
}

body.dashboard-home .user-dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 14px;
    border: 6px solid transparent;
    border-bottom-color: #fff;
    filter: drop-shadow(0 -1px 0 #e2e8f0);
}

body.dashboard-home .header-user:hover .user-dropdown,
body.dashboard-home .header-user:focus-within .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

body.dashboard-home .user-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #1e3a5f;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
}

body.dashboard-home .user-dropdown a i {
    width: 18px;
    color: #64748b;
    text-align: center;
}

body.dashboard-home .user-dropdown a:hover {
    background: #f1f5f9;
}

body.dashboard-home .user-dropdown-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 6px 0;
}

body.dashboard-home .user-dropdown a.logout-link {
    color: #ef4444;
}

body.dashboard-home .user-dropdown a.logout-link i {
    color: #ef4444;
}

body.dashboard-home .header-messages { position: relative; text-decoration: none; }

body.dashboard-home .header-messages .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 0.6rem;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 2px solid #fff;
}

/* Stats — 6 cards in a row */
body.dashboard-home .dash-stats-row {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
    width: 100%;
}

body.dashboard-home .dash-stat-card {
    background: #fff;
    border: 1px solid var(--dash-border);
    border-radius: 12px;
    padding: 16px 14px;
    display: flex !important;
    gap: 12px;
    align-items: flex-start;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    min-width: 0;
    position: relative;
}

.dash-stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    flex-shrink: 0;
}

.dash-stat-icon.blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.dash-stat-icon.green { background: linear-gradient(135deg, #22c55e, #16a34a); }
.dash-stat-icon.purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.dash-stat-icon.orange { background: linear-gradient(135deg, #f97316, #ea580c); }
.dash-stat-icon.teal { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.dash-stat-icon.pink { background: linear-gradient(135deg, #ec4899, #db2777); }

.dash-stat-body { min-width: 0; flex: 1; }
.dash-stat-body h3 { font-size: 1.2rem; margin: 0 0 2px; color: var(--dash-text); }
.dash-stat-body p { margin: 0 0 4px; font-size: 0.75rem; color: var(--dash-muted); }
.dash-stat-link { font-size: 0.72rem; color: #3b82f6; display: block; }

/* Main 2-column: table + widgets */
body.dashboard-home .dash-main-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 16px;
    align-items: start;
    width: 100%;
}

body.dashboard-home .dash-sidebar-widgets {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.dash-panel {
    background: #fff;
    border: 1px solid var(--dash-border);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    overflow: hidden;
}

.dash-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--dash-border);
}

.dash-panel-header h2 { margin: 0; font-size: 1rem; font-weight: 700; color: var(--dash-text); }
.dash-panel-header a { font-size: 0.85rem; color: #3b82f6; }

.dash-table-wrap { overflow-x: auto; width: 100%; }

.dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.dash-table th {
    text-align: left;
    padding: 12px 16px;
    background: #f8fafc;
    color: var(--dash-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    border-bottom: 1px solid var(--dash-border);
    white-space: nowrap;
}

.dash-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--dash-border);
    color: var(--dash-text);
    vertical-align: middle;
}

.dash-table .site-link { color: #3b82f6; font-weight: 600; }

.metric-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.8rem;
    color: #fff;
}

.metric-badge.dr { background: #22c55e; }
.metric-badge.da { background: #3b82f6; }

.btn-buy-post {
    background: #3b82f6;
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.dash-wallet-widget {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    padding: 24px 20px;
    border-radius: 12px;
    text-align: center;
}

.dash-wallet-widget h3 { font-size: 2rem; margin: 8px 0 16px; color: #fff; }

.dash-wallet-widget .btn {
    background: rgba(255,255,255,0.95);
    color: #1d4ed8;
    font-weight: 700;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
}

.dash-activity-widget { padding: 0; overflow: hidden; }

.dash-activity-widget .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1e293b;
    color: #fff;
    padding: 12px 16px;
}

.dash-activity-widget .section-header h3 { margin: 0; color: #fff; font-size: 0.9rem; }
.dash-activity-widget .section-header a { color: #93c5fd; font-size: 0.82rem; }

.dash-activity-widget #dashActivityList,
.dash-activity-widget .activity-empty { padding: 16px; }

.dash-activity-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--dash-border);
    font-size: 0.82rem;
}

.dash-activity-item time { color: var(--dash-muted); font-size: 0.75rem; }

/* Sidebar nav — scoped inside sidebar only */
body.dashboard-home .sidebar .nav-group { margin-bottom: 4px; }

body.dashboard-home .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;
}

body.dashboard-home .sidebar .nav-group-items {
    display: none;
    padding-left: 12px;
}

body.dashboard-home .sidebar .nav-group.open .nav-group-items { display: block; }

body.dashboard-home .sidebar .nav-sub {
    display: flex !important;
    padding-left: 36px !important;
    font-size: 0.85rem !important;
}

/* Bonus bar */
.bonus-countdown-bar {
    position: fixed;
    bottom: 0;
    left: 280px;
    right: 0;
    z-index: 900;
    background: linear-gradient(90deg, #1e293b, #334155);
    color: #fff;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.bonus-countdown-bar .countdown { font-weight: 700; color: #fbbf24; }

.btn-claim-bonus {
    background: linear-gradient(180deg, #fcd34d, #f59e0b);
    color: #1e293b;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}

body.dashboard-home.has-promo-bar .dashboard-content { padding-bottom: 100px; }

@media (max-width: 1400px) {
    body.dashboard-home .dash-stats-row { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}

@media (max-width: 1100px) {
    body.dashboard-home .dash-main-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 992px) {
    body.dashboard-home .dashboard-header {
        left: 0;
        justify-content: space-between !important;
    }
    body.dashboard-home .dashboard-header > .sidebar-toggle { display: block !important; }
    .bonus-countdown-bar { left: 0; }
    body.dashboard-home .dash-stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    body.dashboard-home .header-balance-pills { display: none; }
}

@media (max-width: 768px) {
    body.dashboard-home .dash-stats-row { grid-template-columns: 1fr !important; }
}

/* Other advertiser pages — same fixed header offset */
body.dashboard-home.advertiser-inner .dashboard-content {
    padding-top: 76px;
}

body.dashboard-home.advertiser-inner .page-header h1 { color: var(--dash-text); }
body.dashboard-home.advertiser-inner .page-header p { color: var(--dash-muted); }

body.dashboard-home.advertiser-inner .filters-panel,
body.dashboard-home.advertiser-inner .marketplace-table-wrap,
body.dashboard-home.advertiser-inner .stat-card,
body.dashboard-home.advertiser-inner .orders-panel,
body.dashboard-home.advertiser-inner .account-card,
body.dashboard-home.advertiser-inner .projects-card {
    background: #fff;
    border-color: var(--dash-border);
    color: var(--dash-text);
}
