/* V18.11.1 - Stable Recovery Style (Matches Screenshot) */
:root {
    --bg-deep: #0b0b14;
    --card-bg: #11111c;
    --sidebar-bg: #09090f;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-main: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --radius-lg: 16px;
    --radius-md: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg-deep);
    color: var(--text-main);
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--glass-border);
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    padding: 24px;
    z-index: 1000;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.logo-text h1 {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #6366f1;
}

.logo-subtitle {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-dim);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
}

.nav-item svg {
    width: 20px;
    height: 20px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-item.active {
    background: #6366f1;
    color: white;
}

/* Sidebar Clock - Matches Screenshot */
.sidebar-clock {
    margin-top: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.clock-time {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
}

.clock-date {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 4px;
}

/* Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #60a5fa;
}

.user-status {
    font-size: 0.75rem;
    color: #10b981;
}

/* Main Content */
.main-content {
    margin-left: 280px;
    padding: 40px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 800;
}

.breadcrumb {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 4px;
}

.breadcrumb .separator {
    margin: 0 8px;
}

/* Header Stats */
.header-stats {
    display: flex;
    gap: 16px;
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: #181824;
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    min-width: 100px;
    justify-content: center;
}

.stat-value {
    font-weight: 700;
    font-size: 0.9rem;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    display: block;
}

/* Dashboard Sections */
.section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

/* Grid Layouts - Fixed for V18 Match */
.streams-grid,
.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    grid-auto-rows: 1fr;
    gap: 15px;
}

.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.status-badge {
    padding: 6px 12px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #10b981;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Form Styles */
.form-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 30px;
    width: 100%;
    max-width: 900px;
}

.form-header {
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 24px;
}

.form-row {
    display: flex;
    gap: 20px;
}

.form-group.half {
    flex: 1;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dim);
}

input,
select,
textarea {
    width: 100%;
    background: #000;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: white;
    font-size: 0.95rem;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: 0.2s;
}

/* Video Cards */
.video-card {
    background: #11111c;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    transition: 0.3s;
}

.video-card:hover {
    border-color: #6366f1;
    transform: translateY(-5px);
}

.video-card img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    background: #000;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    border: 1px dashed var(--glass-border);
}

.btn-primary {
    background: #6366f1;
    color: white;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid var(--glass-border);
}

/* The White Accent Button from Screenshot */
.btn-accent {
    background: #ffffff;
    color: #000000;
    padding: 20px 30px;
    font-size: 1.1rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

.btn-accent svg {
    width: 28px;
    height: 28px;
}

.btn-accent:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
}

.btn-large {
    width: auto;
    min-width: 200px;
}

/* Page management */
.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Hamburger (Minimal) */
.hamburger-btn {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    background: var(--accent-primary);
    border: none;
    color: white;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 20px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .hamburger-btn {
        display: block;
    }
}

/* Toasts */
#toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 12px 24px;
    border-radius: 8px;
    background: #6366f1;
    color: white;
    font-weight: 600;
    opacity: 0;
    transform: translateY(20px);
    transition: 0.3s;
    pointer-events: none;
    z-index: 3000;
}

#toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* --- AI Controls Styling --- */
.mini-select {
    background: #1a1a2e;
    border: 1px solid #333;
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    height: 28px;
    width: auto;
    /* Force auto width to prevent 100% stacking */
    min-width: 100px;
}

.mini-select:hover {
    border-color: #6366f1;
    background: #242442;
}

.ai-engine-box {
    background: rgba(0, 0, 0, 0.4) !important;
    border: 1px solid #333 !important;
    padding: 12px !important;
    margin: 15px 0 !important;
}

.ai-pref-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

/* --- V19.1 UI ALIGNMENT FIXES --- */
.stream-card-v2 {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stream-card-v2:hover {
    border-color: var(--accent-primary) !important;
    transform: translateY(-4px);
    box-shadow: 0 10px 30px -10px var(--accent-glow);
}

.title-box {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    line-height: 1.4;
    height: 40px;
    /* Force consistent height for 2 lines */
    margin: 0;
}

.card-btn {
    font-size: 11px;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.card-btn:hover {
    transform: scale(1.05);
}

.source-badge {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}