:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #64748b;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --background: #ffffff;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--background);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0, transparent 50%), 
        radial-gradient(at 100% 0%, rgba(217, 70, 239, 0.1) 0, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    color: var(--text-main);
}

.topic-search-container {
    width: 60%;
    margin: 10%;
    background: var(--card-bg);
    padding: 64px 48px;
    border-radius: 40px;
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.1);
    border: 1px solid #f1f5f9;
    position: relative;
    z-index: 10;
}

/* Top Navigation Buttons Styles */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.back-btn, .school-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    text-decoration: none;
    cursor: pointer;
}

.back-btn {
    background: #f1f5f9;
    color: #475569;
    border: 1.5px solid #e2e8f0;
}

.back-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
    transform: translateX(-4px);
}

.school-mode-btn {
    background: white;
    color: var(--primary);
    border: 2px solid #eef2ff;
    box-shadow: var(--shadow-sm);
}

.school-mode-btn:hover {
    background: #f5f3ff;
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

@media (max-width: 768px) {
    .topic-search-container {
        min-width: 90%;
        margin: auto;
        padding: 20px 16px;
        border-radius: 0;
        box-shadow: none;
    }

    h1 {
        font-size: 1.75rem;
    }

    .desc {
        font-size: 1rem;
        margin-bottom: 28px;
    }

    .top-nav {
        margin-bottom: 20px;
    }

    .back-btn, .school-mode-btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }

    .search-input {
        padding: 14px 16px;
        padding-right: 60px;
        font-size: 1rem;
        height: 56px;
    }

    .search-btn {
        width: 48px;
        height: 48px;
        right: 4px;
        font-size: 1.1rem;
        border-radius: 12px;
    }

    .search-input-wrapper {
        margin-bottom: 16px;
    }

    .level-container {
        gap: 8px;
    }

    .level-btn {
        padding: 10px 8px;
        font-size: 0.85rem;
        gap: 5px;
    }

    .selected-topics-section {
        padding: 20px 16px;
    }

    .topics-scroll-container {
        max-height: 350px; /* Shorter scroll container on mobile */
    }

    .mcq-count-controls {
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .search-input {
        padding: 12px 14px;
        padding-right: 54px;
        font-size: 0.95rem;
        height: 52px;
    }

    .search-btn {
        width: 44px;
        height: 44px;
        right: 4px;
    }

    .level-container {
        flex-direction: column;
        gap: 10px;
    }

    .level-btn {
        width: 100%;
        padding: 12px;
    }
}

h1 {
    font-size: 3.5rem;
    font-weight: 950;
    color: #0f172a;
    margin-bottom: 20px;
    letter-spacing: -0.05em;
    text-align: center;
    line-height: 1;
}

.desc {
    text-align: center;
    color: #64748b;
    font-size: 1.25rem;
    margin-bottom: 56px;
    max-width: 650px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.search-section {
    margin-bottom: 32px;
}

.search-input-wrapper {
    position: relative;
    margin-bottom: 24px;
}

.search-input {
    width: 100%;
    padding: 16px 24px;
    padding-right: 120px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    background: #f8fafc;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    outline: none;
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.search-btn:hover {
    transform: translateY(-50%) translateY(-2px) scale(1.05);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.level-container {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.level-btn {
    flex: 1;
    padding: 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
}

.level-btn:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    background: white;
    color: var(--primary);
}

.level-btn.selected-easy {
    background: #10b981 !important;
    color: white !important;
    border-color: #10b981 !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.level-btn.selected-medium {
    background: #f59e0b !important;
    color: white !important;
    border-color: #f59e0b !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.level-btn.selected-hard {
    background: #ef4444 !important;
    color: white !important;
    border-color: #ef4444 !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.results-section {
    margin-top: 40px;
    animation: fadeIn 0.5s ease-out;
}

.results-header {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.topics-scroll-container {
    max-height: 500px;
    overflow-y: auto;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.topics-scroll-container::-webkit-scrollbar {
    width: 8px;
}

.topics-scroll-container::-webkit-scrollbar-track {
    background: transparent;
}

.topics-scroll-container::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

.topics-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

.topic-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

.topic-item {
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.topic-item:hover {
    border-color: var(--primary-light);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.topic-item.selected {
    border-color: var(--primary);
    background: #f5f3ff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.topic-item.selected::after {
    content: '✓';
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--primary);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
}

.topic-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.topic-similarity {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    background: #eef2ff;
    padding: 4px 12px;
    border-radius: 100px;
    align-self: flex-start;
}

/* Professional AI Loader Overlay */
.ai-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.98) 0%, rgba(2, 6, 23, 1) 100%);
    backdrop-filter: blur(12px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.ai-loader-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    padding: 60px;
    border-radius: 40px;
    max-width: 550px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 80px rgba(99, 102, 241, 0.1), inset 0 0 20px rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.ai-icon-container {
    font-size: 5rem;
    margin-bottom: 32px;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 120px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 30px;
    animation: floatingIcon 3s ease-in-out infinite;
}

.ai-icon-glow {
    position: absolute;
    width: 150%;
    height: 150%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes floatingIcon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(0.8); opacity: 0.3; }
    50% { transform: scale(1.2); opacity: 0.6; }
}

.ai-loader-title {
    font-size: 2.25rem;
    font-weight: 900;
    margin-bottom: 40px;
    color: white;
    letter-spacing: -0.05em;
    background: linear-gradient(to right, #fff, #818cf8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ai-steps-list {
    text-align: left;
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-step {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px 24px;
    border-radius: 20px;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.ai-step.active {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    transform: scale(1.02) translateX(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.ai-step.completed {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.05);
}

.ai-step-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.ai-step.active .ai-step-icon {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 15px var(--primary);
    animation: spinIcon 2s linear infinite;
}

.ai-step.completed .ai-step-icon {
    background: var(--success);
    color: white;
}

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

.ai-step-text {
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.1rem;
}

.ai-step.active .ai-step-text {
    color: white;
}

.ai-step.completed .ai-step-text {
    color: var(--success);
}

.ai-progress-container {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 100px;
    overflow: hidden;
    padding: 3px;
}

.ai-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4f46e5, #818cf8, #a855f7);
    background-size: 200% 100%;
    width: 0%;
    border-radius: 100px;
    transition: width 0.4s cubic-bezier(0.1, 0.7, 1.0, 0.1);
    animation: shimmerProgress 2s linear infinite;
}

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

#inlineLoader {
    display: none;
    padding: 60px 0;
    text-align: center;
    background: rgba(248, 250, 252, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 30px;
    margin: 40px 0;
    border: 2px solid var(--border);
    box-shadow: var(--shadow-md);
    animation: loaderFadeIn 0.5s ease;
}

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

#loaderText {
    color: var(--primary);
    font-weight: 900;
    font-size: 1.4rem;
    margin-top: 24px;
    letter-spacing: -0.02em;
}

/* Upgrade Modal Styles */
.upgrade-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.upgrade-modal-card {
    background: white;
    padding: 48px;
    border-radius: 32px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    animation: modalSlideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.upgrade-modal-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 24px;
    box-shadow: 0 10px 20px rgba(245, 158, 11, 0.3);
}

.upgrade-modal-title {
    font-size: 2rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 16px;
    letter-spacing: -0.025em;
}

.upgrade-modal-text {
    color: #64748b;
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 32px;
}

.upgrade-features-list {
    text-align: left;
    background: #f8fafc;
    padding: 24px;
    border-radius: 20px;
    margin-bottom: 32px;
}

.upgrade-feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    color: #334155;
    font-weight: 600;
}

.upgrade-feature-item:last-child {
    margin-bottom: 0;
}

.upgrade-feature-item i {
    color: #10b981;
    font-size: 1.2rem;
}

.upgrade-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-upgrade-now {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: white;
    padding: 18px;
    border-radius: 16px;
    font-weight: 800;
    font-size: 1.1rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.btn-upgrade-now:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.4);
    color: white;
}

.btn-maybe-later {
    background: transparent;
    color: #94a3b8;
    border: none;
    padding: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease;
}

.btn-maybe-later:hover {
    color: #64748b;
}

/* Modern Honeycomb Scanning Animation */
.honeycomb {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    height: 40px;
}

.honeycomb div {
    width: 12px;
    height: 32px;
    background: var(--primary);
    border-radius: 100px;
    animation: honeyWave 1.2s ease-in-out infinite;
}

.honeycomb div:nth-child(1) { animation-delay: 0.1s; background: #6366f1; }
.honeycomb div:nth-child(2) { animation-delay: 0.2s; background: #818cf8; }
.honeycomb div:nth-child(3) { animation-delay: 0.3s; background: #a855f7; }
.honeycomb div:nth-child(4) { animation-delay: 0.4s; background: #c084fc; }
.honeycomb div:nth-child(5) { animation-delay: 0.5s; background: #a855f7; }
.honeycomb div:nth-child(6) { animation-delay: 0.6s; background: #818cf8; }
.honeycomb div:nth-child(7) { animation-delay: 0.7s; background: #6366f1; }

@keyframes honeyWave {
    0%, 100% { transform: scaleY(0.4); opacity: 0.5; }
    50% { transform: scaleY(1); opacity: 1; }
}

.loader-progress {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: #e2e8f0;
    border-radius: 100px;
    margin: 32px auto 0;
    overflow: hidden;
    position: relative;
}

.loader-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    width: 0%;
    border-radius: 100px;
    transition: width 0.4s ease;
    position: relative;
    overflow: hidden;
}

.loader-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: loaderShimmer 1.5s infinite;
}

@keyframes loaderShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

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

/* Selected Topics Section Styles */
.selected-topics-section {
    background: #f8fafc;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 48px;
    transition: all 0.3s ease;
}

.selected-topics-section.empty {
    display: none;
}

.selected-topics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.selected-topics-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
}

.selected-topics-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 32px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 8px;
}

.selected-topics-list::-webkit-scrollbar {
    width: 6px;
}

.selected-topics-list::-webkit-scrollbar-track {
    background: transparent;
}

.selected-topics-list::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

.selected-topics-list::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

.selected-topic-badge {
    background: white;
    border: 1px solid var(--primary-light);
    color: var(--primary-dark);
    padding: 8px 16px;
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
    animation: badgePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes badgePop {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.remove-topic-btn {
    background: #fee2e2;
    color: var(--danger);
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
    transition: all 0.2s ease;
}

.remove-topic-btn:hover {
    background: var(--danger);
    color: white;
}

.quiz-config-section {
    background: white;
    padding: 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.start-quiz-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
}

.start-quiz-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(99, 102, 241, 0.5);
}

.start-quiz-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    box-shadow: none;
}

.no-selection-hint {
    width: 100%;
    text-align: center;
    color: var(--text-muted);
    padding: 32px;
    font-weight: 600;
    font-size: 1.1rem;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    background: #f8fafc;
}

.quiz-config-header {
    display: block;
    margin-bottom: 15px;
    font-weight: 800;
    color: var(--text-main);
    font-size: 1.1rem;
    text-align: center;
}

.mcq-count-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 32px;
}

.mcq-count-input {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 900;
    width: 80px;
    border: 2px solid var(--primary);
    border-radius: 15px;
    background: var(--card-bg);
    color: var(--text-main);
    padding: 8px;
    transition: all 0.3s ease;
}

.mcq-count-input:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.mcq-count-btn {
    padding: 10px 15px;
    border-radius: 12px;
    cursor: pointer;
    background: white;
    border: 2px solid var(--border);
    color: var(--text-main);
    transition: all 0.2s ease;
}

.mcq-count-btn:hover {
    background: #f8fafc;
    border-color: var(--primary-light);
    color: var(--primary);
}

.level-label {
    display: block;
    margin-bottom: 15px;
    font-weight: 800;
    color: var(--text-main);
    font-size: 1.1rem;
}

.level-error {
    color: var(--danger);
    font-size: 0.95rem;
    margin-top: -10px;
    margin-bottom: 20px;
    font-weight: 700;
    display: none;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.no-topics-hint {
    grid-column: 1/-1;
    text-align: center;
    color: var(--text-muted);
    padding: 48px;
    border: 2px dashed var(--border);
    border-radius: 20px;
    background: #f8fafc;
}

.load-more-btn-container {
    text-align: center;
    margin-top: 48px;
}

#loadMoreTopicsBtn.btn-secondary {
    min-width: 320px;
    padding: 18px 30px !important;
    border-radius: 15px !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    background: white !important;
    color: var(--primary) !important;
    border: 2px solid var(--primary-light) !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
}

#loadMoreTopicsBtn.btn-secondary:hover {
    background: #f5f3ff !important;
    border-color: var(--primary) !important;
    transform: translateY(-3px) !important;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.2) !important;
}

#loadMoreTopicsBtn.btn-secondary i {
    font-size: 1.2rem !important;
}

#loadMoreLoader {
    width: 100%;
    max-width: 350px;
    margin: 30px auto;
    display: none;
}

.load-more-text {
    text-align: center;
    margin-top: 15px;
    color: var(--primary);
    font-weight: 800;
    font-size: 1rem;
}

.btn-secondary {
    background: #ffffff;
    color: #475569;
    border: 2px solid var(--border);
    box-shadow: var(--shadow-sm);
}

/* Enhanced Clear All Button */
.btn-clear-all.btn-secondary {
    padding: 10px 20px !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    color: var(--danger) !important;
    border: 2px solid #fee2e2 !important;
    background: white !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow-sm) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    height: auto !important;
    min-height: unset !important;
}

.btn-clear-all.btn-secondary:hover {
    background: #fef2f2 !important;
    border-color: var(--danger) !important;
    color: #b91c1c !important;
    transform: translateY(-2px) !important;
    box-shadow: var(--shadow-md) !important;
}

.btn-clear-all.btn-secondary i {
    color: inherit !important;
    font-size: 1rem !important;
}

/* SEO Article Section Layout Fix */
.seo-article-section {
    max-width: 1400px;
    width: 94%;
    margin: 100px auto 140px;
    padding: 0;
}

.seo-section-title {
    text-align: center;
    font-size: 2.25rem;
    font-weight: 900;
    color: #1e293b;
    margin-bottom: 56px;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.seo-intro-text {
    text-align: center;
    max-width: 800px;
    margin: -30px auto 60px;
    font-size: 1.2rem;
    line-height: 1.8;
    color: #475569;
}

.seo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
}

.seo-card {
    background: white;
    padding: 40px;
    border-radius: 28px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.02);
    border: 1.5px solid #f1f5f9;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.seo-card:hover {
    transform: translateY(-12px);
    box-shadow: 0 24px 48px rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.2);
}

.seo-icon {
    width: 64px;
    height: 64px;
    background: #f8fafc;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 28px;
    transition: all 0.3s ease;
    color: var(--primary);
}

.seo-card:hover .seo-icon {
    background: var(--primary);
    color: white;
    transform: rotate(-5deg) scale(1.1);
}

.seo-card-title {
    font-size: 1.45rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.seo-card-text {
    color: #64748b;
    font-size: 1.05rem;
    line-height: 1.7;
    margin: 0;
}

.seo-footer {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 80px;
    padding: 40px;
    background: #f8fafc;
    border-radius: 24px;
    color: #64748b;
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    .seo-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .seo-article-section {
        width: 100%;
        margin: 60px auto 100px;
        padding: 0 16px;
    }
    .seo-card {
        padding: 28px 24px;
        border-radius: 24px;
    }
    .seo-section-title {
        font-size: 1.75rem;
        margin-bottom: 32px;
    }

    /* Mobile AI Loader Fix */
    .ai-loader-overlay {
        align-items: flex-start;
        padding-top: 20px;
        overflow-y: auto;
    }

    .ai-loader-card {
        padding: 28px 18px;
        width: 96%;
        border-radius: 20px;
        margin: 10px auto;
    }

    .ai-icon-container {
        width: 72px;
        height: 72px;
        font-size: 2.5rem;
        margin-bottom: 16px;
        border-radius: 20px;
    }

    .ai-loader-title {
        font-size: 1.35rem;
        margin-bottom: 20px;
    }

    .ai-steps-list {
        gap: 8px;
        margin-bottom: 20px;
    }

    .ai-step {
        padding: 10px 14px;
        gap: 12px;
        border-radius: 12px;
    }

    .ai-step.active {
        transform: scale(1.01) translateX(4px);
    }

    .ai-step-text {
        font-size: 0.92rem;
    }

    .ai-step-icon {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
        flex-shrink: 0;
    }

    #loadMoreTopicsBtn.btn-secondary {
        min-width: unset !important;
        width: 100%;
    }
}
