/* Define CSS Variables for a modern, cohesive look */
:root {
    --primary-blue: #1C54F2;
    --primary-hover: #1541c2;
    --bg-main: #F8FAFC;
    --bg-surface: #FFFFFF;
    --bg-dark-card: #2A3241;
    --bg-darker-card: #1E2532;
    
    --text-dark: #1E293B;
    --text-gray: #64748B;
    --text-light: #94A3B8;
    
    --border-color: #E2E8F0;
    
    /* Accents */
    --accent-blue-light: #eff6ff;
    --accent-yellow-light: #fefce8;
    --accent-yellow: #ca8a04;
    --accent-green-light: #f0fdf4;
    --accent-green: #16a34a;
    --accent-purple: #f3e8ff;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px 32px 24px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-blue);
}

.brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-icon svg {
    width: 28px;
    height: 28px;
    stroke-width: 2.5;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 16px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-gray);
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    color: var(--text-light);
    transition: color 0.2s ease;
}

.nav-item:hover, .nav-item.active {
    background-color: var(--accent-blue-light);
    color: var(--primary-blue);
}

.nav-item:hover svg, .nav-item.active svg {
    color: var(--primary-blue);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Important for flex children to not overflow */
}

/* Topbar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px 16px 32px;
    background-color: var(--bg-main);
}

.greeting h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
}

.greeting p {
    font-size: 0.875rem;
    color: var(--text-gray);
    margin-top: 4px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-gray);
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.icon-button:hover {
    background-color: var(--border-color);
}

/* Scrollable Content Area */
.content-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: 0 32px 32px 32px;
}

/* Executive Summary Card */
.executive-summary {
    background: linear-gradient(145deg, var(--bg-dark-card), var(--bg-darker-card));
    border-radius: var(--radius-xl);
    padding: 28px;
    color: white;
    margin-bottom: 32px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

/* decorative blob */
.executive-summary::after {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
}

.summary-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.summary-icon {
    width: 48px;
    height: 48px;
    background-color: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.05);
}

.summary-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.summary-header p {
    font-size: 0.875rem;
    color: #9ba3af; /* specific light gray for dark bg */
    margin-top: 2px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.stat-box {
    background-color: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.05);
    padding: 16px;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.stat-box:hover {
    transform: translateY(-2px);
    background-color: rgba(255,255,255,0.08);
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.75rem;
    color: #9ba3af;
}

.progress-section {
    background-color: rgba(0,0,0,0.2);
    padding: 16px;
    border-radius: var(--radius-lg);
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    margin-bottom: 8px;
    color: #cbd5e1;
}

.progress-bar-container {
    height: 8px;
    background-color: rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: 4px;
    transition: width 1s ease-in-out;
}

/* Reusable Section Styles */
.dashboard-section {
    margin-bottom: 32px;
}

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

.section-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-dark);
}

.section-desc {
    font-size: 0.875rem;
    color: var(--text-gray);
    margin-bottom: 20px;
}

.view-all {
    font-size: 0.875rem;
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 500;
}

.view-all:hover {
    text-decoration: underline;
}

/* Quick Actions */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.action-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.action-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: #cbd5e1;
}

.action-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Utilty colors for icons */
.bg-blue-light { background-color: var(--accent-blue-light); }
.text-blue { color: var(--primary-blue); }

.bg-yellow-light { background-color: var(--accent-yellow-light); }
.text-yellow { color: var(--accent-yellow); }

.bg-green-light { background-color: var(--accent-green-light); }
.text-green { color: var(--accent-green); }

.action-text h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.action-text p {
    font-size: 0.75rem;
    color: var(--text-gray);
}

/* Video Reports (NEW REVISION) */
.badge {
    background-color: var(--accent-yellow-light);
    color: var(--accent-yellow);
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 99px;
    border: 1px solid rgba(202, 138, 4, 0.2);
}

.video-reports-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.video-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    gap: 20px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.video-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.video-thumbnail {
    width: 100px;
    height: 100%;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.video-thumbnail.bg-purple {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.video-thumbnail svg {
    width: 32px;
    height: 32px;
    opacity: 0.8;
}

.video-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.video-info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-dark);
}

.course-module {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-bottom: 16px;
}

.video-metrics {
    display: flex;
    gap: 24px;
    margin-bottom: 20px;
}

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

.metric svg {
    width: 20px;
    height: 20px;
    color: var(--primary-blue);
}

.metric div {
    display: flex;
    flex-direction: column;
}

.metric strong {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
}

.metric span {
    font-size: 0.7rem;
    color: var(--text-gray);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-dark);
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    align-self: flex-start;
}

.btn-outline:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
    background-color: var(--accent-blue-light);
}

/* Chat History */
.chat-list {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    gap: 16px;
    transition: background-color 0.2s ease;
}

.chat-item:hover {
    background-color: var(--bg-main);
    cursor: pointer;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background-color: #6366f1; /* Indigo */
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
}

.chat-details {
    flex: 1;
}

.chat-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.chat-status {
    font-size: 0.875rem;
    color: var(--text-light);
    font-style: italic;
}

.badge-warning {
    background-color: var(--accent-yellow-light);
    color: var(--accent-yellow);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Responsive constraints */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .video-reports-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-container {
        height: auto;
        min-height: 100vh;
        overflow-x: hidden;
        overflow-y: auto;
        display: block;
    }
    
    /* Make Sidebar a Bottom Nav */
    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        padding: 8px;
        flex-direction: row;
        border-right: none;
        border-top: 1px solid var(--border-color);
        z-index: 100;
        height: auto;
    }
    
    .brand {
        display: none;
    }
    
    .nav-menu {
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
        padding: 0;
    }
    
    .nav-item {
        flex-direction: column;
        padding: 8px 4px;
        font-size: 0.65rem;
        gap: 4px;
        flex: 1; /* evenly distribute */
    }
    
    .nav-item svg {
        width: 20px;
        height: 20px;
    }
    
    .main-content {
        display: block;
        height: auto;
        padding-bottom: 70px; /* Space for bottom nav */
    }

    /* Topbar adjustments */
    .topbar {
        padding: 16px;
    }
    
    .content-scrollable {
        overflow-y: visible;
        height: auto;
        display: block;
        padding: 0 16px 24px 16px;
    }
    
    .executive-summary {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }
    
    .video-card {
        flex-direction: column;
    }
    
    .video-thumbnail {
        width: 100% !important;
        height: 180px;
    }
    
    .video-metrics {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 16px;
    }
    
    .quick-actions-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
    
    .video-metrics {
        flex-direction: column;
        gap: 12px;
    }
}
