/* Base Styles */
:root {
    --primary-color: #4f46e5;
    --secondary-color: #7c3aed;
    --accent-color: #8b5cf6;
    --text-color: #1f2937;
    --light-text: #6b7280;
    --background: #f9fafb;
    --card-bg: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* Header Styles */
header {
    margin-bottom: 3rem;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.logo {
    height: 60px;
    width: auto;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.logo:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.header-text h1 {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
    line-height: 1.2;
}

.tagline {
    color: var(--light-text);
    font-size: 1.1rem;
    margin-top: 0.25rem;
}

/* Hero Section */
.hero {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 4rem;
}

.hero h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

.hero-description {
    font-size: 1.25rem;
    color: var(--light-text);
    margin-bottom: 2.5rem;
    line-height: 1.7;
}

/* Search Box */
.search-container {
    position: relative;
    max-width: 700px;
    margin: 0 auto 3rem;
}

.search-box {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 50px;
    padding: 0.5rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: var(--transition);
}

.search-box.searching {
    box-shadow: 0 0 0 2px var(--primary-color);
}

.search-box.searching::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    animation: loading 2s linear infinite;
    background-size: 200% 100%;
}

@keyframes loading {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* Video Cards */
.video-card {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    transition: var(--transition);
    overflow: hidden;
}

.video-card img {
    width: 200px;
    height: 120px;
    border-radius: 8px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-card:hover img {
    transform: scale(1.05);
}

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

.video-info h3 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    color: var(--text-color);
}

.video-info .channel {
    color: var(--light-text);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.watch-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    text-decoration: none;
    font-size: 0.9rem;
    width: fit-content;
    transition: var(--transition);
}

.watch-btn:hover {
    background: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Notifications */
.notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #333;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    max-width: 300px;
}

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

.notification.error {
    background: #ef4444;
}

.notification.success {
    background: #10b981;
}

/* Loading spinner */
.fa-spinner {
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

/* No videos message */
.no-videos {
    text-align: center;
    color: var(--light-text);
    padding: 2rem;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
}

.search-box::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    z-index: -1;
    margin: -2px;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    animation: gradient 3s ease infinite;
    background-size: 200% 200%;
}

@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.search-icon {
    color: var(--light-text);
    margin: 0 1rem;
    font-size: 1.25rem;
}

#topic-input {
    flex: 1;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-color);
}

#topic-input::placeholder {
    color: #9ca3af;
}

.gradient-btn {
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    border-radius: 50px;
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2), 0 2px 4px -1px rgba(79, 70, 229, 0.1);
}

.gradient-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3), 0 4px 6px -2px rgba(79, 70, 229, 0.15);
}

/* Features */
.features {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.feature i {
    color: var(--primary-color);
    font-size: 1.25rem;
}

.feature:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Footer */
footer {
    text-align: center;
    margin-top: auto;
    padding: 2rem 0;
    color: var(--light-text);
    font-size: 0.9rem;
}

/* Flashcards Section */
.flashcards-section {
    padding: 2rem;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.flashcards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    perspective: 1000px; /* For 3D effect */
}

.flashcard {
    background-color: transparent;
    height: 200px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flashcard:hover {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    font-size: 1.1rem;
}

.flashcard-front {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-weight: 600;
}

.flashcard-back {
    background-color: #f9fafb; /* Light gray */
    color: var(--text-color);
    transform: rotateY(180deg);
    font-size: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem;
    }
    
    .logo-container {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .header-text h1 {
        font-size: 1.875rem;
    }
    
    .hero h2 {
        font-size: 2rem;
    }
    
    .hero-description {
        font-size: 1.1rem;
    }
    
    .search-box {
        flex-direction: column;
        padding: 1rem;
        border-radius: 16px;
    }
    
    #topic-input {
        width: 100%;
        margin-bottom: 1rem;
        text-align: center;
    }
    
    .gradient-btn {
        width: 100%;
    }
    
    .features {
        gap: 1rem;
    }
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* Quiz Page Styles */
#quiz-container {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow);
    max-width: 800px;
    margin: 0 auto;
    animation: fadeIn 0.5s ease-out;
}

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

#question-counter {
    font-size: 1rem;
    font-weight: 500;
    color: var(--light-text);
}

#score {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    background-color: #eef2ff;
    padding: 0.5rem 1rem;
    border-radius: 50px;
}

#question-text {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 2rem;
    line-height: 1.4;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.option-btn {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    padding: 1rem;
    text-align: left;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.option-btn:hover {
    border-color: var(--primary-color);
    background-color: #eef2ff;
    transform: translateY(-2px);
}

.option-btn.correct {
    background-color: #dcfce7;
    border-color: #22c55e;
    color: #166534;
    font-weight: 600;
}

.option-btn.incorrect {
    background-color: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
}

.option-btn.correct::after, .option-btn.incorrect::after {
    content: '';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background-size: contain;
}

.option-btn.correct::after {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%2322c55e"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></svg>');
}

.option-btn.incorrect::after {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23ef4444"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>');
}

#feedback-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: #f9fafb;
    border-radius: 8px;
    border-left: 5px solid var(--primary-color);
}

#feedback-text {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

#explanation-text {
    color: var(--light-text);
    line-height: 1.6;
}

#next-question {
    display: block;
    width: 100%;
    margin-top: 1.5rem;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    background: var(--primary-color);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

#next-question:hover {
    background: var(--secondary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Results Page Styles */
.results-card {
    background-color: white;
    text-align: center;
    padding: 2.5rem;
}

.results-card h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.results-card p {
    font-size: 1.1rem;
    color: var(--light-text);
    margin-bottom: 2rem;
}

.score-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3rem;
    margin: 2.5rem 0;
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: conic-gradient(var(--primary-color) 0% 75%, #e5e7eb 75% 100%); /* Example gradient */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.score-circle::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    background: var(--card-bg);
    border-radius: 50%;
}

.score-circle span {
    position: relative;
    z-index: 1;
}

.score-circle span:first-child {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
}

.score-circle span:last-child {
    font-size: 1rem;
    color: var(--light-text);
    margin-top: -5px;
}

.badge-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.badge {
    font-size: 1.2rem;
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    background: #eef2ff;
    color: var(--primary-color);
    border-radius: 50px;
    margin-bottom: 0.5rem;
}

.badge-container span {
    font-size: 1rem;
    color: var(--light-text);
    font-weight: 500;
}

.recommendations {
    margin-top: 2.5rem;
    text-align: left;
    border-top: 1px solid #e5e7eb;
    padding-top: 2rem;
}

.recommendations h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.recommendations ul {
    list-style: none;
    padding: 0;
}

.recommendations li {
    margin: 10px 0;
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}

.action-buttons button {
    padding: 12px 24px;
}

#retry-quiz {
    background-color: #4CAF50;
}

#new-topic {
    background-color: #2196F3;
}

/* Badge level colors */
.badge.level-1 { background-color: #9E9E9E; } /* Beginner */
.badge.level-2 { background-color: #4CAF50; } /* Intermediate */
.badge.level-3 { background-color: #2196F3; } /* Advanced */
.badge.level-4 { background-color: #9C27B0; } /* Expert */
.badge.level-5 { background-color: #FF9800; } /* Master */

/* Score circle colors based on performance */
.score-circle.low { background-color: #F44336; }
.score-circle.medium { background-color: #FFC107; }
.score-circle.high { background-color: #4CAF50; }