/* ==========================================================================
   CKM Faceless Channel DB - Shadcn / Modern Dark Zinc Theme
   ========================================================================== */

:root {
    --bg-base: #09090b;
    --bg-surface: #121215;
    --bg-card: #18181b;
    --bg-elevated: #27272a;
    --bg-hover: #3f3f46;
    
    --border-color: #27272a;
    --border-subtle: #1f1f23;
    --border-focus: #38bdf8;
    
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    
    --accent-primary: #38bdf8;
    --accent-indigo: #6366f1;
    --accent-purple: #8b5cf6;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    font-size: 14px;
    line-height: 1.5;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* App Layout: Sidebar + Main Content */
.app-layout {
    display: flex;
    width: 100vw;
    min-height: 100vh;
}

/* SIDEBAR */
.app-sidebar {
    width: 260px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 50;
}

.sidebar-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-badge {
    background: linear-gradient(135deg, #0284c7, #6366f1);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.3);
}

.brand-info h1 {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.3px;
}

.brand-info p {
    font-size: 11px;
    color: var(--text-muted);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-category {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 10px 10px 4px 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
    cursor: pointer;
    border: 1px solid transparent;
    background: transparent;
    text-align: left;
    width: 100%;
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.nav-item.active {
    background: #18181b;
    color: var(--accent-primary);
    border-color: rgba(56, 189, 248, 0.3);
    font-weight: 600;
}

.nav-item svg {
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border-color);
    background: #0d0d10;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.worker-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--accent-emerald);
    background: rgba(16, 185, 129, 0.1);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

/* MAIN CONTENT */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-base);
}

.top-navbar {
    height: 60px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(18, 18, 21, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent-primary);
    color: #09090b;
}
.btn-primary:hover {
    background: #7dd3fc;
}

.btn-secondary {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-secondary);
}
.btn-secondary:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: #3f3f46;
}

.btn-gradient-purple {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
}
.btn-gradient-purple:hover {
    box-shadow: 0 0 18px rgba(99, 102, 241, 0.5);
    transform: translateY(-1px);
}

.btn-gradient-rose {
    background: linear-gradient(135deg, #f43f5e, #fb7185);
    color: #fff;
    border: none;
    box-shadow: 0 0 12px rgba(244, 63, 94, 0.3);
}

/* OVERVIEW METRICS SECTION */
.content-wrapper {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s;
}

.kpi-card:hover {
    border-color: #3f3f46;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.4), transparent);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
}

.kpi-value {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
}

/* 3-COLUMN EXPLORER GRID */
.explorer-container {
    display: grid;
    grid-template-columns: 280px 320px 1fr;
    gap: 16px;
    height: calc(100vh - 220px);
    min-height: 550px;
}

.explorer-col {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.col-header {
    padding: 12px 14px;
    background: #151518;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.col-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.col-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.col-toolbar {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    background: #111114;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.search-input {
    width: 100%;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    color: var(--text-primary);
    font-size: 12px;
    outline: none;
    font-family: inherit;
}
.search-input:focus {
    border-color: var(--accent-primary);
}

.filter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}

.filter-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.items-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.12s;
    user-select: none;
}

.list-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.list-item.active {
    background: #18181b;
    border-color: var(--accent-primary);
    color: #fff;
    font-weight: 600;
}

.list-item.item-selected {
    background: rgba(56, 189, 248, 0.08);
    border-color: rgba(56, 189, 248, 0.3);
}

/* BADGES */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.badge-cpm {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-diamond {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-gold {
    background: rgba(250, 204, 21, 0.15);
    color: #facc15;
    border: 1px solid rgba(250, 204, 21, 0.3);
}

.badge-silver {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.badge-count {
    background: #27272a;
    color: #a1a1aa;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
}

/* MODALS */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 900px;
    max-height: 88vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

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

.modal-title {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}
.modal-close:hover {
    color: #fff;
}

/* RESPONSIVENESS */
@media (max-width: 1024px) {
    .explorer-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    .app-sidebar {
        width: 70px;
    }
    .brand-info, .nav-item span, .nav-category, .worker-status span {
        display: none;
    }
}
