/**
 * ==============================================
 * FILE: /assets/css/style.css
 * Professional styling with Tailwind + custom
 * ==============================================
 */

:root {
    --primary-color: #f97316;
    --primary-hover: #ea580c;
    --primary-rgb: 249, 115, 22;
}

/* Base Fonts */
* {
    font-family: 'Inter', sans-serif;
}

h1,
h2,
h3,
h4,
.font-heading {
    font-family: 'Poppins', sans-serif;
}

/* ============================================
   DARK MODE
   ============================================ */
html.dark {
    background-color: #0a0a0c;
}

html.dark body {
    background-color: #0a0a0c;
    color: #ededee;
}

html.dark .bg-white {
    background-color: #18181b !important;
}

html.dark .bg-gray-50 {
    background-color: #0f0f12 !important;
}

html.dark .bg-gray-100 {
    background-color: #1f1f24 !important;
}

html.dark .border-gray-200,
html.dark .border-gray-100 {
    border-color: #2a2a30 !important;
}

html.dark .text-gray-500,
html.dark .text-gray-600 {
    color: #a1a1aa !important;
}

html.dark .text-gray-700,
html.dark .text-gray-800,
html.dark .text-gray-900 {
    color: #e4e4e7 !important;
}

html.dark .hover\:bg-gray-100:hover {
    background-color: #27272a !important;
}

html.dark .shadow-sm {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
}

/* ============================================
   3-COLUMN LAYOUT
   ============================================ */
.layout-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .layout-container {
        flex-direction: row;
    }

    .layout-left {
        width: 200px;
        flex-shrink: 0;
    }

    .layout-main {
        flex: 1;
        min-width: 0;
    }

    .layout-right {
        width: 300px;
        flex-shrink: 0;
    }
}

/* Mobile: Main first, then sidebars */
@media (max-width: 767px) {
    .layout-container {
        display: flex;
        flex-direction: column;
    }

    .layout-main {
        order: 1;
    }

    .layout-left {
        order: 2;
        display: block;
        margin-top: 1rem;
    }

    .layout-right {
        order: 3;
        display: block;
        margin-top: 1rem;
    }
}

/* ============================================
   QUIZ CARD
   ============================================ */
.quiz-card {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.quiz-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 25px -12px rgba(0, 0, 0, 0.15);
}

/* ============================================
   THEME DROPDOWN
   ============================================ */
.theme-dropdown {
    position: relative;
    display: inline-block;
}

.theme-dropdown .theme-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0px;
    background: white;
    min-width: 130px;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    z-index: 100;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.theme-dropdown:hover .theme-dropdown-content,
.theme-dropdown-content:hover {
    display: block;
}

html.dark .theme-dropdown-content {
    background: #1f1f24;
    border-color: #3a3a44;
}

.theme-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    background: #f3f4f6;
    transition: background 0.2s;
}

html.dark .theme-trigger {
    background: #27272a;
}

.theme-trigger:hover {
    background: #e5e7eb;
}

html.dark .theme-trigger:hover {
    background: #3f3f46;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
    color: #374151;
}

html.dark .theme-option {
    color: #e4e4e7;
}

.theme-option:hover {
    background: #f3f4f6;
}

html.dark .theme-option:hover {
    background: #3f3f46;
}

/* ============================================
   NAVIGATION
   ============================================ */
.nav-link {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: background 0.2s;
    font-weight: 500;
    color: #374151;
}

html.dark .nav-link {
    color: #e4e4e7;
}

.nav-link:hover {
    background: #f3f4f6;
}

html.dark .nav-link:hover {
    background: #27272a;
}

.btn-home {
    background: #f97316;
    color: white !important;
}

.btn-home:hover {
    background: #ea580c;
    color: white !important;
}

.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 200px;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    z-index: 100;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    margin-top: 4px;
}

html.dark .nav-dropdown-content {
    background: #1f1f24;
    border-color: #3a3a44;
}

.nav-dropdown:hover .nav-dropdown-content {
    display: block;
}

.nav-dropdown-item {
    display: block;
    padding: 10px 16px;
    text-decoration: none;
    transition: background 0.2s;
    font-size: 14px;
    color: #374151;
}

html.dark .nav-dropdown-item {
    color: #e4e4e7;
}

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

html.dark .nav-dropdown-item:hover {
    background: #3f3f46;
}

/* Mobile Menu (slide-down from top) */
.mobile-menu {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: white;
    z-index: 200;
    border-bottom: 1px solid #e5e7eb;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

html.dark .mobile-menu {
    background: #1f1f24;
    border-color: #3a3a44;
}

.mobile-menu.open {
    display: block;
}

.mobile-menu-item {
    display: block;
    padding: 14px 20px;
    border-bottom: 1px solid #f3f4f6;
    font-weight: 500;
    cursor: pointer;
}

html.dark .mobile-menu-item {
    border-color: #3a3a44;
}

.mobile-submenu {
    padding-left: 20px;
    background: #f9fafb;
}

html.dark .mobile-submenu {
    background: #18181b;
}

.mobile-submenu a {
    display: block;
    padding: 10px 16px;
    text-decoration: none;
    color: #4b5563;
}

html.dark .mobile-submenu a {
    color: #a1a1aa;
}

/* ============================================
   SEARCH
   ============================================ */
.search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
}

.search-overlay.active {
    display: block;
}

.search-modal {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 40px -12px rgba(0, 0, 0, 0.25);
    z-index: 201;
    overflow: hidden;
}

html.dark .search-modal {
    background: #1f1f24;
}

.search-modal input {
    width: 100%;
    padding: 14px 18px;
    border: none;
    outline: none;
    font-size: 16px;
    background: white;
}

html.dark .search-modal input {
    background: #1f1f24;
    color: white;
}

.search-results {
    max-height: 350px;
    overflow-y: auto;
    border-top: 1px solid #e5e7eb;
}

html.dark .search-results {
    border-top-color: #3a3a44;
}

.search-item {
    display: block;
    padding: 12px 18px;
    text-decoration: none;
    transition: background 0.2s;
    color: #374151;
}

html.dark .search-item {
    color: #e4e4e7;
}

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

html.dark .search-item:hover {
    background: #3f3f46;
}

/* Sidebar */
.category-link {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s;
    color: #4b5563;
}

html.dark .category-link {
    color: #a1a1aa;
}

.category-link:hover {
    background: #f3f4f6;
}

html.dark .category-link:hover {
    background: #27272a;
}

.category-link.active {
    background: #fff7ed;
    color: #ea580c;
    font-weight: 600;
}

html.dark .category-link.active {
    background: #431407;
    color: #f97316;
}

.sidebar-search {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    outline: none;
    transition: border 0.2s;
}

.sidebar-search:focus {
    border-color: #f97316;
}

html.dark .sidebar-search {
    background: #1f1f24;
    border-color: #3a3a44;
    color: white;
}

/* Quiz Page */
.quiz-option {
    cursor: pointer;
    transition: all 0.2s;
}

.quiz-option.selected {
    background: #fff7ed;
    border-color: #f97316 !important;
}

html.dark .quiz-option.selected {
    background: #3f3f46;
}

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Utility */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   LANGUAGE SWITCHER DROPDOWN
   ============================================ */

.lang-dropdown {
    position: relative;
    display: inline-block;
}

.lang-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    height: 38px;
    border-radius: 9999px;
    cursor: pointer;
    background: #f3f4f6;
    transition: background 0.2s;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

html.dark .lang-trigger {
    background: #27272a;
    color: #e4e4e7;
}

.lang-trigger:hover {
    background: #e5e7eb;
}

html.dark .lang-trigger:hover {
    background: #3f3f46;
}

.lang-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0px;
    background: white;
    min-width: 140px;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    z-index: 100;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

html.dark .lang-dropdown-content {
    background: #1f1f24;
    border-color: #3a3a44;
}

.lang-dropdown:hover .lang-dropdown-content,
.lang-dropdown-content:hover {
    display: block;
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    text-decoration: none;
    transition: background 0.2s;
    font-size: 14px;
    color: #374151;
}

html.dark .lang-option {
    color: #e4e4e7;
}

.lang-option:hover {
    background: #f3f4f6;
}

html.dark .lang-option:hover {
    background: #3f3f46;
}

.lang-option.active {
    background: #fff7ed;
    color: #ea580c;
    font-weight: 600;
}

html.dark .lang-option.active {
    background: #431407;
    color: #f97316;
}

/* ============================================
   QUIZ PAGE & HEADER
   ============================================ */
.quiz-header-image-container {
    position: relative;
    width: 100%;
    margin-bottom: 2rem;
    border-radius: 1.5rem;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    background: #f3f4f6;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

html.dark .quiz-header-image-container {
    background: #18181b;
    border-color: rgba(255, 255, 255, 0.1);
}

.quiz-header-image {
    width: 100%;
    height: 440px;
    display: block;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), filter 0.6s ease;
}

.quiz-header-image-container:hover .quiz-header-image {
    transform: scale(1.05);
    filter: brightness(0.85);
}

.quiz-header-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 3rem 2.5rem 2.5rem;
    background: linear-gradient(to top,
            rgba(0, 0, 0, 0.9) 0%,
            rgba(0, 0, 0, 0.6) 40%,
            rgba(0, 0, 0, 0.2) 75%,
            transparent 100%);
    color: white;
    z-index: 10;
    pointer-events: none;
}

.quiz-header-overlay * {
    pointer-events: auto;
}

.quiz-header-content {
    margin-bottom: 2.5rem;
}

.quiz-header-overlay .quiz-title {
    font-size: 2.25rem;
    line-height: 1.2;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

html.dark .quiz-header-overlay .quiz-title {
    color: #ffffff;
}

@media (min-width: 768px) {
    .quiz-header-overlay .quiz-title {
        font-size: 3.5rem;
    }
}

.quiz-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #4b5563;
}

html.dark .stat-item {
    color: #a1a1aa;
}

.stat-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.75rem;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--theme-primary, #e67e22);
}

html.dark .stat-icon {
    background: #27272a;
}

.category-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid #e5e7eb;
}

html.dark .category-badge {
    background: #27272a;
    color: #d1d5db;
    border-color: #3f3f46;
}

.subcategory-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}


.question-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

html.dark .question-image {
    border-color: #3a3a44;
}

.quiz-option {
    border-color: #e5e7eb;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quiz-option:hover {
    border-color: var(--theme-primary) !important;
    background: var(--theme-secondary-alpha, rgba(255, 213, 179, 0.25));
}

.quiz-option.selected {
    border-color: var(--theme-primary) !important;
    background: var(--theme-secondary) !important;
}

html.dark .quiz-option {
    border-color: #3a3a44;
}

html.dark .quiz-option:hover {
    background: #3f3f46 !important;
}

html.dark .quiz-option.selected {
    background: #3f3f46 !important;
    border-color: var(--theme-primary) !important;
}

.progress-bar {
    height: 6px;
    background: #e5e7eb;
    width: 100%;
}

html.dark .progress-bar {
    background: #27272a;
}

.progress-fill {
    height: 100%;
    background: var(--theme-primary, #f97316);
    width: 0%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 768px) {
    .feature-image-hero {
        height: 380px;
        border-radius: 1.5rem;
        margin-bottom: 2rem;
    }

    .feature-image-hero .hero-content {
        padding: 1.5rem;
    }

    .feature-image-hero h1 {
        font-size: 1.75rem !important;
    }
}

/* Animations */
@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-slide {
    animation: fadeInSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-scale-in {
    animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Smooth Height Dropdown */
.expandable-container {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s;
    opacity: 0;
}

.expandable-container.expanded {
    grid-template-rows: 1fr;
    opacity: 1;
}

.expandable-content {
    overflow: hidden;
}

/* Tab Switching Animation */
.tab-content-active {
    animation: fadeInSlide 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Global Focus & Accent Colors (Remove Blue) */
*:focus {
    outline: none !important;
}

select:focus,
input:focus,
textarea:focus,
button:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.2) !important;
}

select {
    accent-color: var(--primary-color);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23f97316'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem !important;
}

/* Theme-consistent text selection */
::selection {
    background-color: rgba(var(--primary-rgb), 0.4);
    color: white;
}


/* Fix for native dropdown background in dark mode */
html.dark select option {
    background-color: #18181b;
    color: #e4e4e7;
}

/* Chrome/Safari/Mobile specific focus & highlight fixes */
* {
    -webkit-tap-highlight-color: transparent !important;
}

select:-webkit-direct-focus {
    outline: none !important;
}

select::-moz-focus-inner {
    border: 0;
}

/* ============================================
   SCROLL TO TOP BUTTON
   ============================================ */
#scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 20px;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.7) 0%, rgba(219, 39, 119, 0.7) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(249, 115, 22, 0.2);
}

#scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    bottom: 80px;
    /* Offset for potential anchor ads */
}

#scroll-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(249, 115, 22, 0.4);
    background: linear-gradient(135deg, #f97316 0%, #db2777 100%);
    color: white;
    border-color: transparent;
}

#scroll-to-top i {
    font-size: 1rem;
    transition: transform 0.3s ease;
}

/* Mobile adjustments */
@media (max-width: 767px) {
    #scroll-to-top {
        bottom: 20px;
        right: 15px;
        width: 36px;
        height: 36px;
    }

    #scroll-to-top.visible {
        bottom: 90px;
        /* Higher on mobile to clear bottom nav/ads */
    }
}

html.dark #scroll-to-top {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.7) 0%, rgba(219, 39, 119, 0.7) 100%);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

html.dark #scroll-to-top:hover {
    background: linear-gradient(135deg, #f97316 0%, #db2777 100%);
    color: white;
}