/* CSS Custom Properties */
:root {
    --header-height: 89px;
}

.dashboard-wrapper {
    width: 100%;
}

.dashboard-container {
    display: flex;
    width: 100%;
    min-height: calc(100vh - 200px);
    align-items: stretch;
}

/* Sidebar */
.sidebar {
    width: 200px;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    padding: 16px 0;
    flex-shrink: 0;
    overflow-y: visible;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    border-radius: 12px;
    margin-right: 20px;
    align-self: stretch;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

.logo {
    padding: 0 24px 32px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 24px;
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: rgb(55, 155, 254);
}

.nav-menu {
    list-style: none;
    padding: 0 16px;
}

/* Divider between stacked nav sections (unified viewer + creator sidebar) */
.sidebar-section-break {
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    margin: 6px 16px;
    opacity: 1;
}

/* Unified sidebar only: tighter gap above first two dividers.
   Nav lives in `.sidebar-unified-inner` so a collapse toggle can sit above without breaking nth-child. */
.sidebar-unified .sidebar-unified-inner > ul:nth-child(1) .nav-link {
    padding-bottom: 2px;
}

.sidebar-unified .sidebar-unified-inner > hr:nth-child(2) {
    margin-top: 0;
    margin-bottom: 6px;
}

.sidebar-unified .sidebar-unified-inner > ul:nth-child(3) .nav-item:last-child .nav-link {
    padding-bottom: 2px;
}

.sidebar-unified .sidebar-unified-inner > hr:nth-child(4) {
    margin-top: 0;
    margin-bottom: 6px;
}

.sidebar-unified .sidebar-unified-inner > ul:nth-child(5) .nav-item:last-child .nav-link {
    padding-bottom: 2px;
}

.sidebar-unified .sidebar-unified-inner > hr:nth-child(6) {
    margin-top: 0;
    margin-bottom: 6px;
}

/* Scroll the nav stack; collapse button stays at top */
.sidebar-unified-inner {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

/* ================================
   Sidebar collapse toggle (settings.html + unified dashboard sidebar)
   Shared with settings — same classes: `.settings-sidebar-toggle`, `.sidebar--collapsed`
   ================================ */
.settings-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    padding: 6px 10px 6px 14px;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.45);
    border-radius: 8px;
    transition: color 0.2s, padding 0.2s;
    margin-bottom: 6px;
    font-size: 1rem;
    flex-shrink: 0;
}

.settings-sidebar-toggle:hover {
    color: #fff;
}

.settings-sidebar.sidebar--collapsed,
.sidebar.sidebar-unified.sidebar--collapsed {
    width: 56px !important;
    min-width: 56px !important;
    overflow-x: hidden;
    transition: width 0.2s ease;
}

.settings-sidebar.sidebar--collapsed .settings-sidebar-toggle,
.sidebar.sidebar-unified.sidebar--collapsed .settings-sidebar-toggle {
    justify-content: center;
    padding: 6px;
}

.settings-sidebar.sidebar--collapsed .nav-link,
.sidebar.sidebar-unified.sidebar--collapsed .nav-link {
    position: relative;
    justify-content: center;
    padding: 10px 6px;
    min-height: 44px;
}

.settings-sidebar.sidebar--collapsed .nav-icon,
.sidebar.sidebar-unified.sidebar--collapsed .nav-icon {
    margin-right: 0;
}

.settings-sidebar.sidebar--collapsed .nav-link-text,
.sidebar.sidebar-unified.sidebar--collapsed .nav-link-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.settings-sidebar,
.sidebar.sidebar-unified {
    transition: width 0.2s ease;
}

@media (max-width: 767.98px) {
    .settings-sidebar-toggle {
        display: none;
    }
}

.nav-item {
    margin-bottom: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 6px 14px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 14px;
}

.nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-link.active {
    background: rgba(55, 155, 254, 0.2);
    color: rgb(55, 155, 254);
    border: 1px solid rgb(55, 155, 254);
}

.nav-icon {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    display: inline-block;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 32px;
    min-height: 100%;
}

/* Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-wrap: wrap;
    gap: 16px;
}

.dashboard-header h2 {
    font-size: 28px;
    font-weight: 600;
    color: rgb(55, 155, 254);
}

.header-actions {
    display: flex;
    gap: 12px;
}

.btn-primary-custom {
    background: linear-gradient(135deg, rgb(55, 155, 254) 0%, #4a9eff 100%);
    color: white;
    border: none;
}

.btn-primary-custom:hover {
    background: linear-gradient(135deg, #4a9eff 0%, rgb(55, 155, 254) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(55, 155, 254, 0.4);
}

.btn-secondary-custom {
    background: transparent;
    color: rgb(55, 155, 254);
    border: 1px solid rgb(55, 155, 254);
}

.btn-secondary-custom:hover {
    background: rgba(55, 155, 254, 0.1);
    color: rgb(55, 155, 254);
}

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

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid rgba(255,255,255,0.1);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

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

.stat-label {
    font-size: 14px;
    color: rgba(255,255,255,0.7);
    font-weight: 500;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: white;
    margin-bottom: 8px;
}

.stat-change {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-change.positive {
    color: #10b981;
}

.stat-change.negative {
    color: #ef4444;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-icon.blue { background: rgba(55, 155, 254, 0.2); color: rgb(55, 155, 254); }
.stat-icon.green { background: rgba(16, 185, 129, 0.2); color: #10b981; }
.stat-icon.orange { background: rgba(249, 137, 0, 0.2); color: #f98900ff; }
.stat-icon.purple { background: rgba(147, 51, 234, 0.2); color: #9333ea; }

/* Performance page — tighter stat cards */
.stats-grid.stats-grid--performance-compact {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.stats-grid.stats-grid--performance-compact .stat-card {
    padding: 14px 16px;
    border-radius: 10px;
}

.stats-grid.stats-grid--performance-compact .stat-card:hover {
    transform: translateY(-1px);
}

.stats-grid.stats-grid--performance-compact .stat-header {
    margin-bottom: 0;
    align-items: flex-start;
    gap: 10px;
}

.stats-grid.stats-grid--performance-compact .stat-label {
    font-size: 12px;
}

.stats-grid.stats-grid--performance-compact .stat-value {
    font-size: 22px;
    margin-bottom: 4px;
    line-height: 1.2;
}

.stats-grid.stats-grid--performance-compact .stat-change {
    font-size: 11px;
    line-height: 1.35;
}

.stats-grid.stats-grid--performance-compact .stat-icon {
    width: 32px;
    height: 32px;
    font-size: 16px;
    border-radius: 6px;
    flex-shrink: 0;
}

.stats-grid.stats-grid--performance-compact .stat-icon svg.subscription-rate-icon {
    width: 1.5rem;
    height: 1.5rem;
}

/* Subscription metric — user + $ mark */
.stat-icon svg.subscription-rate-icon {
    width: 2rem;
    height: 2rem;
    display: block;
    flex-shrink: 0;
}

/* Chart Section */
.chart-section {
    background: rgba(255, 255, 255, 0.05);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    margin-bottom: 32px;
    border: 1px solid rgba(255,255,255,0.1);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.chart-title {
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.chart-placeholder {
    height: 300px;
    background: linear-gradient(135deg, rgba(55, 155, 254, 0.1) 0%, rgba(74, 158, 255, 0.05) 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.6);
    font-size: 16px;
    border: 1px dashed rgba(55, 155, 254, 0.3);
}

/* Filters */
.filters {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.filter-label {
    font-size: 14px;
    color: rgba(255,255,255,0.7);
    font-weight: 500;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    font-size: 14px;
    background: rgba(255,255,255,0.05);
    color: white;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: rgb(55, 155, 254);
}

/* Campaigns Table */
.campaigns-section {
    background: rgba(255, 255, 255, 0.05);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    color: white;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: rgba(255,255,255,0.05);
}

th {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid rgba(255,255,255,0.1);
}

td {
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 14px;
    color: rgba(255,255,255,0.9);
}

tbody tr:hover {
    background: rgba(55, 155, 254, 0.1);
}

tr.koi-top-content-play-row {
    cursor: pointer;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-active {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.status-paused {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.status-pending {
    background: rgba(249, 137, 0, 0.2);
    color: #f98900ff;
}

.campaign-name {
    font-weight: 600;
    color: white;
}

.campaign-type {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    margin-top: 4px;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: rgba(255,255,255,0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: white;
}

.btn-icon:hover {
    background: rgba(55, 155, 254, 0.3);
}

/* Footer positioning */
#footer-container {
    width: 100%;
    clear: both;
    margin-top: 0;
}

/* Stack buttons below title when screen is too narrow */
@media (max-width: 992px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-actions {
        width: 100%;
        flex-wrap: wrap;
    }
}

.creator-content-new-video-card {
    background: linear-gradient(135deg, rgba(55, 155, 254, 0.16) 0%, rgba(55, 155, 254, 0.08) 100%);
    border: 1px solid rgba(55, 155, 254, 0.25);
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    text-align: center;
}

.creator-content-new-video-card:hover,
.creator-content-new-video-card:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    border-color: rgba(55, 155, 254, 0.5);
}

.creator-content-checkbox-col {
    width: 3rem;
}

.creator-content-thumb-col {
    width: 76px;
}

.creator-content-actions-col {
    width: 5.5rem;
    vertical-align: middle;
}

.creator-content-table-thumb {
    width: 60px;
    height: 34px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.06);
}

.creator-content-edit-badge-btn {
    padding: 0.35rem 0.75rem;
    line-height: 1.2;
    white-space: nowrap;
}

.creator-content-toggle-btn {
    min-height: 38px;
}

.creator-content-title-input {
    min-width: 0;
}

/* Performance — top content table */
.performance-top-content-thumb {
    width: 88px;
    height: 50px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.06);
}

@media (max-width: 767px) {
    .creator-content-table-thumb {
        width: 60px;
        height: 34px;
    }

    .performance-top-content-thumb {
        width: 72px;
        height: 40px;
    }
}

