﻿:root {
    --primary-color: #0066cc;
    --secondary-color: #0055aa;
    --accent-color: #ff7e33;
    --text-color: #333;
    --light-text: #666;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --border-radius: 12px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --header-bg: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    --header-text: #ffffff;
}

.dark-mode {
    --primary-color: #4a9dff;
    --secondary-color: #3a8bef;
    --text-color: #f0f0f0;
    --light-text: #b0b0b0;
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --header-bg: linear-gradient(135deg, #0f1a2e 0%, #1a2c4d 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 0;
    max-width: 500px;
    /* Mobile-first constraint from original */
    margin: 0 auto;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
}

body.admin-view {
    max-width: 100%;
}

body.admin-view .bottom-nav {
    display: none !important;
}

/* Header Styles */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 20px;
    background: var(--header-bg);
    color: var(--header-text);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff7e33, #f5af19);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.om-container {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: bold;
    transition: var(--transition);
}

.om-container:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.header h1 {
    color: var(--header-text);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    margin: 0;
}

/* Update both to match exactly */
.app-title,
.section-header h2 {
    font-size: 32px;
    font-weight: 900;
    line-height: 1.4;
    margin: 0;
}

.app-title {
    color: #FFFFFF;
    display: inline-block;
    padding: 10px;
}

.header-right {
    display: flex;
    gap: 10px;
}

.header-icon {
    font-size: 20px;
    color: var(--header-text);
    cursor: pointer;
    transition: var(--transition);
    padding: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Welcome & Search Styles */
.welcome-container {
    text-align: center;
    padding: 30px 20px 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-bottom: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.welcome-title {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.welcome-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.5;
}

.top-container {
    padding: 20px;
    display: flex;
    justify-content: center;
}

.ui-card {
    background: var(--card-bg);
    padding: 18px 22px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 90%;
    max-width: 600px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
}

.ui-card:hover {
    transform: translateY(-2px);
}

select,
input[type="text"],
input[type="password"],
input[type="date"],
textarea {
    padding: 12px 14px;
    font-size: 16px;
    border-radius: 10px;
    border: 1px solid #dcdcdc;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--card-bg);
    color: var(--text-color);
}

select:focus,
input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

input[type="text"] {
    flex: 1;
}

/* Results & Lists */
#results {
    max-width: 600px;
    margin: 0 auto 20px;
    padding: 10px;
    font-size: 18px;
}

.item {
    background: var(--card-bg);
    padding: 15px 15px 15px 50px;
    margin-bottom: 10px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    cursor: pointer;
    transition: var(--transition);
    border-left: 4px solid transparent;
    position: relative;
}

.item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    border-left-color: var(--primary-color);
}

.item-logo {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.category-item {
    background: rgba(0, 102, 204, 0.1);
    padding: 12px 15px 12px 50px;
    margin-bottom: 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    position: relative;
}

.category-item:hover {
    background: rgba(0, 102, 204, 0.2);
    border-color: var(--primary-color);
    transform: translateX(5px);
}

.category-logo {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
    font-weight: bold;
}

/* Detail View */
#detailBox {
    max-width: 600px;
    margin: 20px auto;
    background: var(--card-bg);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    font-size: 18px;
    line-height: 1.8;
    animation: fadeIn 0.3s ease;
}

.content-title {
    text-align: center;
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--primary-color);
    line-height: 1.3;
}

.content-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-color);
    text-align: justify;
}

.content-counter {
    text-align: center;
    margin-top: 25px;
    padding: 12px;
    background: rgba(0, 102, 204, 0.05);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--light-text);
    border: 1px solid rgba(0, 102, 204, 0.1);
}

.counter-number {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* Calendar Styles */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 0 20px;
}

.back-button {
    font-size: 20px;
    color: var(--primary-color);
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    background: rgba(0, 102, 204, 0.1);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-title {
    font-size: 24px;
    color: var(--primary-color);
    font-weight: 600;
}

.tithi-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 20px 20px;
}

.tithi-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-radius: var(--border-radius);
    background-color: var(--card-bg);
    box-shadow: var(--box-shadow);
    cursor: pointer;
}

.tithi-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 102, 204, 0.1);
    border-radius: 50%;
    margin-right: 15px;
    color: var(--primary-color);
    font-size: 18px;
}

.tithi-details {
    flex: 1;
}

.tithi-name {
    font-weight: 600;
    margin-bottom: 3px;
}

.tithi-date {
    font-size: 14px;
    color: var(--light-text);
}

/* Tithi Info */
.tithi-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 20px;
}

.tithi-info-title {
    font-size: 24px;
    color: var(--primary-color);
    font-weight: 600;
}

.tithi-info-content {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    margin: 0 20px 20px;
    box-shadow: var(--box-shadow);
}

.tithi-info-name {
    font-size: 22px;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-weight: 600;
}

.tithi-info-date {
    font-size: 16px;
    color: var(--light-text);
    margin-bottom: 15px;
}

.tithi-info-details {
    line-height: 1.6;
}

/* Admin Panel Styles */
.admin-container {
    display: flex;
    min-height: calc(100vh - 100px);
}

.sidebar {
    width: 250px;
    background: var(--card-bg);
    padding: 20px;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 10px;
}

.sidebar-menu a {
    display: block;
    padding: 10px 15px;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition);
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(0, 102, 204, 0.1);
    color: var(--primary-color);
}

.main-content {
    flex: 1;
    padding: 20px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn:hover {
    opacity: 0.9;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    /* Vertical spacing between rows */
    margin-top: 20px;
    background: transparent;
    /* Transparent to show spacing */
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
    border: none;
}

.table th,
.table td {
    padding: 16px 20px;
    text-align: center;
    border: none;
    /* Remove default borders */
}

.table th {
    background: linear-gradient(to right, #f12711, #f5af19);
    /* Attractive Gradient */
    color: white;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    border-radius: 8px;
    /* Rounded header */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
}

/* Apply styles to rows instead of table */
.table tbody tr {
    background: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.table tbody tr td:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.table tbody tr td:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.table tbody tr:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    background-color: white;
    /* Keep white on hover */
    z-index: 1;
    position: relative;
}

/* Remove old zebra striping as we use cards now */
.table tr:nth-child(even) {
    background-color: white;
}

/* Utilities */
.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 24px;
    }

    select,
    input[type="text"] {
        width: 100%;
    }

    .admin-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        margin-bottom: 20px;
    }

    .menu-container {
        justify-content: flex-start;
        /* Align start for scrolling */
        padding-bottom: 10px;
        /* Space for scrollbar if visible */
    }

    .menu-btn {
        font-size: 16px;
        padding: 6px 16px;
    }
}

/* Calendar Menu Styles */
.menu-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin: 25px 0;
}

.menu-container {
    display: flex;
    justify-content: flex-start;
    /* Align start */
    align-items: center;
    gap: 10px;
    margin: 0;
    /* Margin handled by wrapper */
    overflow-x: auto;
    /* Enable horizontal scroll */
    white-space: nowrap;
    /* Prevent wrapping */
    -webkit-overflow-scrolling: touch;
    /* Smooth scroll on iOS */
    scrollbar-width: none;
    /* Firefox */
    flex: 1;
    /* Take remaining space */
    scroll-behavior: smooth;
}

.menu-container::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari/Opera */
}

.scroll-btn {
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-size: 24px;
    cursor: pointer;
    padding: 0 10px;
    z-index: 1;
    transition: 0.3s ease;
}

.scroll-btn:hover {
    transform: scale(1.1);
}

.menu-btn {
    font-size: 18px;
    font-weight: 600;
    border: none;
    padding: 8px 20px;
    border-radius: 30px;
    color: #fff;
    cursor: pointer;
    transition: 0.3s ease;
    flex-shrink: 0;
    /* Prevent shrinking */
}

.menu-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2);
}

.tithi {
    background-color: #F1D64B;
    color: #000;
}

.rashifal {
    background-color: #C62828;
}

.rahukal {
    background-color: #546E7A;
}

.vichar {
    background-color: #2E7D32;
}

.panchang {
    background-color: #D32F2F;
}


/* Temple Grid Styles */
.container {
    max-width: 950px;
    margin: auto;
    padding: 20px;
    text-align: center;
}

.container h2 {
    color: #c10000;
    font-weight: 700;
    margin-bottom: 15px;
    font-size: 26px;
}

.temple-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-gap: 14px;
    margin-bottom: 25px;
}

.temple-card {
    background: #fff;
    border-radius: 10px;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: 0.3s ease;
}

.temple-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.18);
}

.temple-card .icon {
    font-size: 22px;
    color: #ff4b50;
}

.temple-text {
    font-size: 15px;
    text-align: left;
    color: #333;
    font-weight: 600;
}

/* Bottom Navigation */
/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #fff;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 0;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    /* Handle safe area */
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #666;
    font-size: 12px;
    cursor: pointer;
}

.bottom-nav-item i {
    font-size: 20px;
    margin-bottom: 4px;
}

.bottom-nav-item.active {
    color: var(--primary-color);
}

.bottom-nav-item.active i {
    color: var(--primary-color);
}

/* Responsive: Bottom Nav Always Visible */
.page {
    padding-bottom: 80px;
    /* Space for bottom nav on all screens */
}

/* Desktop: Center and constrain width to mimic mobile */
@media (min-width: 769px) {
    .bottom-nav {
        width: 100%;
        max-width: 400px;
        /* Typical mobile width */
        left: 50%;
        transform: translateX(-50%);
        border-radius: 20px 20px 0 0;
        /* Optional: rounded top corners for floating look */
        box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.15);
        /* Slightly stronger shadow for floating effect */
    }
}



/* Responsive Stats Container */
@media (max-width: 480px) {
    .stats-container {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 15px;
    }

    .stats-box {
        width: 100%;
        box-sizing: border-box;
    }
}

/* Search Page Styles */
.tithi-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.tithi-item {
    background: #fff;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: transform 0.2s;
}

.tithi-item:active {
    transform: scale(0.98);
}

.tithi-icon {
    width: 40px;
    height: 40px;
    background: #ffebee;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 18px;
}

.tithi-details {
    flex: 1;
}

.tithi-name {
    font-weight: 600;
    color: #333;
    font-size: 16px;
    margin-bottom: 2px;
}

.tithi-date {
    font-size: 13px;
    color: #666;
}

.search-input-container {
    position: relative;
    margin-bottom: 20px;
}

.search-input-container input {
    width: 100%;
    padding: 15px;
    padding-left: 45px;
    border: 2px solid #eee;
    border-radius: 12px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
}

.search-input-container input:focus {
    border-color: var(--primary-color);
}

.search-input-container i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

/* Calendar Styles */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 0 20px;
}

.back-button {
    font-size: 20px;
    color: var(--primary-color);
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    background: rgba(0, 102, 204, 0.1);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-title {
    font-size: 24px;
    color: var(--primary-color);
    font-weight: 600;
}

.tithi-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 20px 20px;
}

.tithi-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-radius: var(--border-radius);
    background-color: var(--card-bg);
    box-shadow: var(--box-shadow);
    cursor: pointer;
}

.tithi-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 102, 204, 0.1);
    border-radius: 50%;
    margin-right: 15px;
    color: var(--primary-color);
    font-size: 18px;
}

.tithi-details {
    flex: 1;
}

.tithi-name {
    font-weight: 600;
    margin-bottom: 3px;
}

.tithi-date {
    font-size: 14px;
    color: var(--light-text);
}

/* Tithi Info */
.tithi-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 20px;
}

.tithi-info-title {
    font-size: 24px;
    color: var(--primary-color);
    font-weight: 600;
}

.tithi-info-content {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    margin: 0 20px 20px;
    box-shadow: var(--box-shadow);
}

.tithi-info-name {
    font-size: 22px;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-weight: 600;
}

.tithi-info-date {
    font-size: 16px;
    color: var(--light-text);
    margin-bottom: 15px;
}

.tithi-info-details {
    line-height: 1.6;
}

/* Category Tabs UI */
.category-tabs-container {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    max-width: 100%;
    margin: 20px auto
}

.menu-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 25px 0;
    flex-wrap: nowrap;
    white-space: nowrap;
    padding: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
    min-width: 100%
}

.menu-container::-webkit-scrollbar {
    display: none
}

.menu-btn {
    font-size: 14px;
    font-weight: 600;
    border: none;
    padding: 10px 16px;
    border-radius: 30px;
    color: #fff;
    cursor: pointer;
    transition: all .3s ease;
    flex-shrink: 0
}

.menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, .15)
}

.menu-btn:active {
    transform: translateY(-1px)
}

.menu-btn:focus {
    outline: 2px solid rgba(0, 0, 0, .1);
    outline-offset: 2px
}

.neetikaanti {
    background-color: #4A148C
}

.parba {
    background-color: #1565C0
}

.panchang {
    background-color: #D32F2F
}

.janmadivas {
    background-color: #2E7D32
}

.tiroddhan {
    background-color: #546E7A
}

.bishesh {
    background-color: #E65100
}

.scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    color: #333;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2)
}

.scroll-btn:hover {
    background: #f0f0f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transform: translateY(-50%) scale(1.05)
}

.scroll-btn.left {
    left: -20px
}

.scroll-btn.right {
    right: -20px
}

.scroll-btn i {
    font-size: 18px;
    color: #333
}

/* Wikipedia-style Link Previews */
.wiki-preview-card {
    position: fixed;
    z-index: 10000;
    width: 320px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    padding: 0;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    transform: translateY(10px);
    overflow: hidden;
    font-family: 'Segoe UI', sans-serif;
    border: 1px solid rgba(0, 0, 0, 0.1);
    top: 0;
    left: 0;
}

.wiki-preview-card.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.wiki-preview-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background-color: #f0f0f0;
    display: block;
}

.wiki-preview-content {
    padding: 15px;
    background: #fff;
}

.wiki-preview-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #000;
    line-height: 1.3;
}

.wiki-preview-summary {
    font-size: 14px;
    color: #444;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .wiki-preview-card {
        background: #252525;
        border-color: #444;
    }

    .wiki-preview-content {
        background: #252525;
    }

    .wiki-preview-title {
        color: #eee;
    }
}

/* Quiz Styles */
.quiz-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--header-bg);
    color: var(--header-text);
    border-radius: 0 0 20px 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    margin-bottom: 0 !important;
    /* Override default header margin */
}

.quiz-header-bar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-color), var(--qz-points));
}

.status-card {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    margin: 15px 20px;
    padding: 15px;
    border-radius: 16px;
    color: white;
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.2);
}

.status-item {
    text-align: center;
}

.status-label {
    font-size: 0.8rem;
    opacity: 0.9;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-value {
    font-size: 1.2rem;
    font-weight: 800;
}

/* Category Tabs */
.quiz-categories {
    display: flex;
    overflow-x: auto;
    padding: 10px 20px;
    gap: 12px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.quiz-categories::-webkit-scrollbar {
    display: none;
}

.quiz-tab {
    background: var(--card-bg);
    padding: 8px 16px;
    border-radius: 50px;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--light-text);
}

.quiz-tab.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.quiz-tab:hover:not(.active) {
    background: var(--qz-bg-secondary);
}

/* Subcategory List */
.quiz-list {
    padding: 10px 20px 100px;
}

.subcat-item {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--box-shadow);
    transition: transform 0.2s;
}

.subcat-item:hover {
    transform: translateY(-2px);
}

.subcat-info h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 4px;
}

.subcat-meta {
    font-size: 0.8rem;
    color: var(--light-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.play-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
    transition: transform 0.2s;
}

.play-btn:active {
    transform: scale(0.95);
}

/* Quiz Interface */
.quiz-container {
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 100px;
}

.question-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 25px;
    text-align: center;
    box-shadow: var(--box-shadow);
    margin-bottom: 25px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.question-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1.5;
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.option-btn {
    background: var(--card-bg);
    border: 2px solid rgba(0, 0, 0, 0.1);
    padding: 16px;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.option-btn:hover {
    border-color: var(--primary-color);
    background: var(--qz-bg-secondary);
}

.option-btn.correct {
    background: var(--qz-correct);
    color: white;
    border-color: var(--qz-correct);
    animation: pulse 0.5s;
}

.option-btn.wrong {
    background: var(--qz-wrong);
    color: white;
    border-color: var(--qz-wrong);
    animation: shake 0.4s;
}

/* Feedback */
.feedback-container {
    margin-top: 20px;
    padding: 15px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 600;
    animation: slideUp 0.3s ease;
}

.feedback-container.success {
    background: rgba(22, 163, 74, 0.1);
    color: var(--qz-correct);
    border: 1px solid var(--qz-correct);
}

.feedback-container.error {
    background: rgba(220, 38, 38, 0.1);
    color: var(--qz-wrong);
    border: 1px solid var(--qz-wrong);
}

.feedback-emoji {
    font-size: 1.8rem;
}

.feedback-text {
    display: flex;
    flex-direction: column;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Quiz Theme Overrides & Variables */
:root {
    /* Quiz Specific Variables */
    --qz-correct: #16a34a;
    --qz-wrong: #dc2626;
    --qz-points: #9333ea;
    --qz-coins: #eab308;
    --qz-bg-secondary: #f1f5f9;

    /* Theme Overrides (Requested Palette) */
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --accent-color: #f97316;
    --header-bg: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.dark-mode {
    /* Quiz Specific Dark Mode */
    --qz-correct: #22c55e;
    --qz-wrong: #ef4444;
    --qz-points: #a855f7;
    --qz-coins: #facc15;
    --qz-bg-secondary: #334155;

    /* Theme Overrides */
    --primary-color: #3b82f6;
    --secondary-color: #60a5fa;
    --accent-color: #fb923c;
    --bg-color: #0f172a;
    --card-bg: #1e3b52;
    --header-bg: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
}

/* Modern Quiz Card Styles */
.quiz-list-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 20px;
}

.quiz-card-modern {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 1.5rem;
    padding: 1.25rem;
    display: flex;
    flex-direction: row;
    /* Force Row on Mobile */
    align-items: center;
    /* Center vertically */
    justify-content: space-between;
    gap: 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease;
    cursor: default;
    position: relative;
    overflow: hidden;
}

.dark-mode .quiz-card-modern {
    background: #1e3b52;
    border-color: #334155;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.quiz-card-modern:hover {
    box-shadow: 0 15px 30px -5px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
    border-color: #e2e8f0;
}

.dark-mode .quiz-card-modern:hover {
    border-color: #475569;
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.3);
}

@media (min-width: 640px) {
    .quiz-card-modern {
        /* Desktop styles remain similar but ensure consistency */
        padding: 1.5rem;
        gap: 1.5rem;
    }
}

.quiz-card-left {
    display: flex;
    flex-direction: row;
    /* Force Row on Mobile */
    align-items: center;
    gap: 1rem;
    width: 100%;
}

@media (min-width: 640px) {
    .quiz-card-left {
        gap: 1.25rem;
    }
}

.quiz-icon-container {
    flex-shrink: 0;
    width: 3.5rem;
    /* Smaller on mobile */
    height: 3.5rem;
    background-color: #eff6ff;
    color: #2563eb;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    transition: all 0.3s ease;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

@media (min-width: 640px) {
    .quiz-icon-container {
        width: 4rem;
        height: 4rem;
        font-size: 2rem;
    }
}

.dark-mode .quiz-icon-container {
    background-color: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
}

.quiz-card-modern:hover .quiz-icon-container {
    background-color: #2563eb;
    color: #ffffff;
    transform: scale(1.05) rotate(3deg);
}

.quiz-info {
    display: flex;
    flex-direction: column;
    width: 100%;
    align-items: flex-start;
    /* Left align always */
}

.quiz-cat-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: rgba(59, 130, 246, 0.8);
    text-transform: uppercase;
    margin-bottom: 0.2rem;
    text-align: left;
    /* Left align always */
}

.dark-mode .quiz-cat-label {
    color: rgba(96, 165, 250, 0.9);
}

.quiz-title {
    font-size: 1.1rem;
    /* Smaller title on mobile */
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.015em;
    line-height: 1.2;
    margin-bottom: 0.3rem;
    text-align: left;
    /* Left align always */
}

.dark-mode .quiz-title {
    color: #f1f5f9;
}

@media (min-width: 640px) {
    .quiz-title {
        font-size: 1.5rem;
    }
}

.quiz-meta {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* Left align always */
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.quiz-meta-text {
    color: #94a3b8;
    font-size: 0.75rem;
    /* Smaller meta info */
    font-weight: 500;
}

@media (min-width: 640px) {
    .quiz-meta-text {
        font-size: 0.875rem;
    }
}

.quiz-meta-dot {
    width: 0.2rem;
    height: 0.2rem;
    background-color: #cbd5e1;
    border-radius: 9999px;
}

.quiz-play-btn {
    /* Hide button text on very small screens if needed, or keep compact */
    width: auto;
    background-color: #2563eb;
    color: #ffffff;
    padding: 0.6rem 1.2rem;
    /* Compact padding */
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
    /* Prevent shrinking */
}

@media (min-width: 640px) {
    .quiz-play-btn {
        padding: 0.75rem 2rem;
        font-size: 1rem;
    }
}

.quiz-play-btn:hover {
    background-color: #1d4ed8;
    box-shadow: 0 20px 25px -5px rgba(147, 197, 253, 0.6), 0 8px 10px -6px rgba(147, 197, 253, 0.6);
    transform: translateY(-2px);
}

.quiz-play-btn:active {
    transform: scale(0.95);
}

.topic-main-title {
    color: var(--primary-color);
    font-size: 1.8rem;
    text-align: center;
    align-self: center;
    width: 100%;
    display: block;
    margin: 0 0 15px 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 40px 0 20px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #eee;
}

.section-header h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
    position: relative;
}

.section-header h2::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 60px;
    height: 3px;
    background-color: var(--primary-color);
}

.view-all-link {
    font-size: 0.85rem;
    color: #555;
    text-decoration: none;
    font-weight: 600;
    text-transform: uppercase;
}