/* Main App CSS */

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #22c55e;
    --warning: #eab308;
    --danger: #ef4444;
    --accent-red: #f43f5e;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
}

/* --- LAYOUT --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    background-color: #1e1e2e;
    padding: 2rem;
    border-right: 1px solid var(--border);
    position: sticky;
    top: 0;
    height: 100vh;
    box-sizing: border-box;
}

.main-content {
    padding: 2rem;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        height: auto;
        position: relative;
    }
}

/* --- COMPONENTS --- */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    display: inline-block;
    text-decoration: none;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* --- UTILITIES --- */
.text-xl {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.text-lg {
    font-size: 1.25rem;
    font-weight: 600;
}

.text-muted {
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-8 {
    margin-bottom: 2rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.block {
    display: block;
}

.w-full {
    width: 100%;
}

.hidden {
    display: none !important;
}

.section-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

/* Nav */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-item:hover,
.nav-item.active {
    background-color: var(--primary);
    color: white;
}

/* Forms */
input[type="text"] {
    background-color: #0f172a;
    border: 1px solid var(--border);
    color: white;
    padding: 0.75rem;
    border-radius: 0.5rem;
    width: 100%;
    box-sizing: border-box;
}

input[type="text"]:focus {
    outline: 2px solid var(--primary);
    border-color: transparent;
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.video-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0 !important;
}

.video-card.is-outlier {
    border: 1px solid var(--success);
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.1);
}

.thumbnail-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
}

.thumbnail-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-details {
    padding: 1rem;
}

.badge-viral {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: var(--success);
    color: #000;
    font-weight: 800;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.stats-row {
    display: flex;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.channel-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.channel-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
}

.stat-pill {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    margin-right: 0.5rem;
}

.stat-pill.viral {
    border-color: var(--success);
    color: var(--success);
}

.loading-spinner,
.error-msg {
    padding: 2rem;
    text-align: center;
    width: 100%;
    color: var(--text-muted);
}

.error-msg {
    color: var(--danger);
}

/* CSS Overlay for Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-card);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 2rem;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.close-modal:hover {
    color: white;
}

/* New Buttons */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.topic-card {
    border-left: 4px solid var(--primary);
}

.flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.items-start {
    align-items: flex-start;
}