/* ===============================
   AuraLens Admin Dashboard Styles
   =============================== */

/* Tab Navigation */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 32px;
    gap: 8px;
}

.tab {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.tab:hover {
    color: var(--text-primary);
    background: var(--bg-glass);
}

.tab.active {
    border-bottom-color: var(--accent-subtle);
    color: var(--text-primary);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block !important;
}

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

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Stat Card */
.stat-card {
    background: var(--bg-elevated);
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.stat-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: 8px;
    font-weight: 600;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-trend {
    font-size: 13px;
    color: var(--text-secondary);
}

.trend-up {
    color: #0070f3;
}

.trend-down {
    color: #ee0000;
}

/* Alert Banner */
.alert-banner {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(238, 0, 0, 0.1) 0%, rgba(238, 0, 0, 0.05) 100%);
    border: 1px solid rgba(238, 0, 0, 0.3);
    border-radius: var(--radius-lg);
}

/* Viral Moment Card */
.viral-moment-card {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-bottom: 12px;
    transition: all var(--transition-fast);
}

.viral-moment-card:hover {
    background: var(--bg-elevated);
    transform: scale(1.01);
}

/* Missing Product Card */
.missing-product-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-bottom: 12px;
    transition: all var(--transition-fast);
}

.missing-product-card:hover {
    background: var(--bg-elevated);
}

/* Card */
.card {
    background: var(--bg-elevated);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    /* Prevent early overflow */
}

.table-container {
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border);
}

.data-table tbody td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: var(--bg-glass);
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-ready {
    background: rgba(0, 112, 243, 0.1);
    color: #0070f3;
}

.status-building {
    background: rgba(255, 165, 0, 0.1);
    color: #ffa500;
}

.status-error {
    background: rgba(238, 0, 0, 0.1);
    color: #ee0000;
}

/* Status Dots */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-dot.status-ready {
    background: #0070f3;
}

.status-dot.status-building {
    background: #ffa500;
}

.status-dot.status-error {
    background: #ee0000;
}

/* Mono Font */
.mono {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-size: 13px;
    color: var(--accent-subtle);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
}

.btn-primary {
    background: var(--accent-subtle);
    color: #000000;
}

.btn-primary:hover {
    background: #ffffff;
    transform: scale(1.02);
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-elevated);
}

/* Layout */
.admin-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg-primary);
}

.sidebar {
    width: 240px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 24px 12px;
}

.sidebar-link {
    display: block;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all var(--transition-fast);
    margin-bottom: 4px;
}

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

.sidebar-link.active {
    background: var(--accent-light);
    color: var(--accent-subtle);
}

.main-content {
    flex: 1;
    padding: 48px 64px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Projections Layout */
.projections-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.projection-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.projection-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.projection-item:last-of-type {
    border-bottom: none;
}

/* Projection Tooltips */
.projection-has-tooltip {
    cursor: help;
    transition: background var(--transition-fast);
}

.projection-has-tooltip:hover {
    background: var(--elevation-1);
    padding-left: 8px;
    padding-right: 8px;
    margin-left: -8px;
    margin-right: -8px;
    border-radius: 4px;
}

.projection-tooltip {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-md);
    padding: 16px;
    min-width: 240px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    z-index: 100;
}

.projection-has-tooltip:hover .projection-tooltip {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(-4px);
}

/* Tooltip Arrow */
.projection-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--accent-border);
}

.projection-tooltip::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--bg-elevated);
    z-index: 1;
}

.pj-label {
    font-size: 12px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.pj-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

/* SVG Chart Styles */
.chart-path {
    fill: none;
    stroke: var(--accent-subtle);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 4px 8px rgba(0, 112, 243, 0.3));
}

.chart-area {
    fill: url(#chart-gradient);
    opacity: 0.1;
}

/* Responsive Dashboard */
@media (max-width: 1024px) {
    .projections-layout {
        grid-template-columns: 1fr;
    }
}

/* Responsive Dashboard */
@media (max-width: 768px) {
    .admin-layout {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        left: -240px;
        top: 0;
        bottom: 0;
        z-index: 1000;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
    }

    .sidebar.active {
        transform: translateX(240px);
    }

    .main-content {
        padding: 80px 16px 40px;
        width: 100%;
    }

    .mobile-menu-trigger {
        display: flex;
        position: fixed;
        top: 16px;
        left: 16px;
        z-index: 1001;
        background: var(--bg-glass);
        border: 1px solid var(--border);
        padding: 8px;
        border-radius: var(--radius-md);
        color: var(--text-primary);
        cursor: pointer;
        backdrop-filter: blur(10px);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        z-index: 999;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .stat-value {
        font-size: 24px;
    }

    h1 {
        font-size: 28px;
    }

    .card {
        padding: 16px;
    }

    /* Table Responsiveness */
    .card[style*="overflow: hidden"],
    .card {
        overflow-x: auto !important;
    }

    .data-table {
        min-width: 600px;
    }

    .tab-content header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 16px;
    }

    .tab-content header .btn {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) {

    .mobile-menu-trigger,
    .sidebar-overlay {
        display: none !important;
    }
}