/* Reset và Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f8f9fa;
    color: #333;
    line-height: 1.5;
    overflow-x: hidden;
    font-size: 14px;
}

/* Header - Copy y nguyên từ ai-chat */
.header {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Navigation Menu */
.navbar {
    padding: 1rem 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.nav-menu {
    display: flex;
    gap: 1rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.nav-link:hover::before {
    left: 100%;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 70%;
    height: 3px;
    background: #fbbf24;
    transform: translateX(-50%);
    border-radius: 2px;
}

.nav-auth-container {
    display: flex;
    align-items: center;
}

.nav-auth {
    display: flex;
    gap: 1rem;
}

.auth-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.auth-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.login-btn {
    background: #facc15;
    color: #b91c1c;
    font-weight: 600;
    border-color: #facc15;
}

.login-btn:hover {
    background: #f59e0b;
    border-color: #f59e0b;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.profile-menu {
    position: relative;
}

.profile-toggle {
    background: none;
    border: none;
    cursor: pointer;
}

.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    object-fit: cover;
    display: block;
}

.profile-dropdown {
    position: absolute;
    top: 120%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
    width: 200px;
    overflow: hidden;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    display: none;
}

.profile-dropdown.show {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #374151;
    text-decoration: none;
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background: #f3f4f6;
}

.dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 0.25rem 0;
}

.mobile-auth {
    display: none;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 74px);
    background: #ffffff;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Video List Layout */
.video-list-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.page-header {
    text-align: center;
    margin-bottom: 3rem;
}

.page-header h1 {
    font-size: 2.5rem;
    color: #dc2626;
    margin-bottom: 1rem;
    font-weight: 700;
}

.page-header p {
    font-size: 1.1rem;
    color: #6b7280;
    max-width: 600px;
    margin: 0 auto;
}

/* Video Item - Thanh dài trải ngang */
.video-item {
    display: flex;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.video-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(220, 38, 38, 0.15);
    border-color: #dc2626;
}

.video-thumbnail {
    width: 300px;
    height: 180px;
    background: #f3f4f6;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(220, 38, 38, 0.9);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

.video-item:hover .play-overlay {
    background: rgba(220, 38, 38, 1);
    transform: translate(-50%, -50%) scale(1.1);
}

.video-content {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.video-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.video-description {
    color: #6b7280;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
    color: #9ca3af;
}

.video-duration {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.video-topic {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: #fef2f2;
    color: #dc2626;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 500;
}

/* Video Player Layout */
.video-player-layout {
    display: none;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
    margin-top: 2rem;
}

.video-player-layout.active {
    display: grid;
}

.video-main-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.video-player {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 16/9;
}

.video-player iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.video-info-section {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.current-video-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 1rem;
}

.current-video-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: #6b7280;
}

.quiz-section {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

.quiz-section h3 {
    color: #dc2626;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.quiz-section p {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.start-quiz-btn {
    background: #dc2626;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.start-quiz-btn:hover {
    background: #b91c1c;
    transform: translateY(-1px);
}

/* Video Sidebar */
.video-sidebar {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 80px;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.sidebar-video-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-video-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.sidebar-video-item:hover {
    background: #f9fafb;
    border-color: #e5e7eb;
}

.sidebar-video-item.active {
    background: #fef2f2;
    border-color: #fecaca;
}

.sidebar-video-thumbnail {
    width: 80px;
    height: 45px;
    background: #f3f4f6;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}

.sidebar-video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-video-info {
    flex: 1;
    min-width: 0;
}

.sidebar-video-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: #111827;
    line-height: 1.3;
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sidebar-video-duration {
    font-size: 0.8rem;
    color: #6b7280;
}

/* Quiz Styles */
.quiz-screen {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-top: 2rem;
    border: 1px solid #e5e7eb;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.quiz-title {
    font-size: 1.5rem;
    color: #dc2626;
    font-weight: 600;
}

.quiz-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.progress-bar {
    width: 200px;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #dc2626;
    transition: width 0.3s ease;
}

.timer-circle {
    width: 60px;
    height: 60px;
    position: relative;
}

.timer-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-bg {
    fill: none;
    stroke: #e5e7eb;
    stroke-width: 4;
}

.timer-progress {
    fill: none;
    stroke: #dc2626;
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear;
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    color: #dc2626;
}

.question-container {
    margin-bottom: 2rem;
}

.question-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 2rem;
}

.question-text {
    font-size: 1.2rem;
    color: #111827;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.answers-grid {
    display: grid;
    gap: 1rem;
}

.answer-option {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.answer-option:hover {
    border-color: #dc2626;
    background: #fef2f2;
}

.answer-option.selected {
    border-color: #dc2626;
    background: #fef2f2;
    color: #dc2626;
}

.answer-option.correct {
    border-color: #10b981;
    background: #ecfdf5;
    color: #10b981;
}

.answer-option.incorrect {
    border-color: #ef4444;
    background: #fef2f2;
    color: #ef4444;
}

.answer-letter {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.answer-option.selected .answer-letter {
    background: #dc2626;
    color: white;
}

.answer-option.correct .answer-letter {
    background: #10b981;
    color: white;
}

.answer-option.incorrect .answer-letter {
    background: #ef4444;
    color: white;
}

/* Quiz Controls */
.quiz-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #dc2626;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #b91c1c;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #4b5563;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #059669;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Results Screen */
.results-screen {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-top: 2rem;
    border: 1px solid #e5e7eb;
    text-align: center;
}

.results-header {
    margin-bottom: 2rem;
}

.results-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.results-icon.excellent {
    color: #fbbf24;
}

.results-icon.good {
    color: #3b82f6;
}

.results-icon.average {
    color: #f59e0b;
}

.results-icon.poor {
    color: #ef4444;
}

.score-display {
    font-size: 2rem;
    margin: 1rem 0;
}

.score-number {
    font-weight: 700;
    color: #dc2626;
}

.results-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
}

.stat-item.correct {
    background: #ecfdf5;
    color: #10b981;
}

.stat-item.incorrect {
    background: #fef2f2;
    color: #ef4444;
}

.stat-item.total {
    background: #f3f4f6;
    color: #6b7280;
}

.results-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Loading States */
.loading-placeholder {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.loading-placeholder i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #dc2626;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    text-align: center;
    color: #dc2626;
}

.loading-spinner i {
    font-size: 2rem;
    margin-bottom: 1rem;
}

/* Notification - Copy từ ai-chat */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 350px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification-show {
    transform: translateX(0);
    opacity: 1;
}

.notification-success {
    border-left: 4px solid #10b981;
}

.notification-error {
    border-left: 4px solid #ef4444;
}

.notification-header {
    padding: 16px 20px 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.notification-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-success .notification-icon {
    background-color: #dcfce7;
    color: #16a34a;
}

.notification-error .notification-icon {
    background-color: #fef2f2;
    color: #dc2626;
}

.notification-message {
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.notification-close:hover {
    background-color: #f3f4f6;
    color: #6b7280;
}

.notification-progress {
    height: 3px;
    background-color: #f3f4f6;
    position: relative;
    overflow: hidden;
}

.notification-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #059669);
    width: 100%;
    transform-origin: left;
    animation: progressShrink 5s linear forwards;
}

.notification-error .notification-progress-bar {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

@keyframes progressShrink {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
        z-index: 1001;
    }
    
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
        flex-direction: column;
        padding: 1rem 0;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }
    
    .nav-menu.mobile-open {
        display: flex;
    }
    
    .nav-link {
        padding: 1rem 1.5rem;
    }
    
    .desktop-auth {
        display: none !important;
    }
    
    .profile-menu {
        display: none !important;
    }
    
    .mobile-auth {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        margin-top: 1rem;
        padding: 1rem 1.5rem 0;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .video-player-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .video-sidebar {
        position: static;
    }

    .video-item {
        flex-direction: column;
    }

    .video-thumbnail {
        width: 100%;
        height: 200px;
    }

    .quiz-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .quiz-controls {
        flex-direction: column;
    }

    .results-stats {
        flex-direction: column;
        gap: 1rem;
    }

    .results-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem 0.5rem;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .video-content {
        padding: 1rem;
    }

    .quiz-screen {
        padding: 1rem;
    }

    .question-card {
        padding: 1rem;
    }
}
