/* ══════════════════════════════════════════════════════════════════════════
   model.css — 3D Virtual Science & Interactive Math Lab Studio
   Theme: Modern Clean Light Mode (ธีมสว่างโทนสีฟ้า-น้ำเงินสดใส Ultra Premium)
   ══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Kanit:wght@300;400;500;600;700;800&family=Fira+Code:wght@400;600&display=swap');

:root {
    --bg-light: #f0f7ff;
    --bg-surface: #ffffff;
    --card-surface: rgba(255, 255, 255, 0.88);
    --card-border: rgba(191, 219, 254, 0.75);
    --card-hover-border: #3b82f6;
    --card-hover-glow: rgba(59, 130, 246, 0.22);
    
    --blue-sky: #0284c7;
    --blue-cyan: #0891b2;
    --blue-primary: #2563eb;
    --blue-deep: #1d4ed8;
    --blue-navy: #1e3a8a;
    --blue-light: #dbeafe;

    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-accent: #1d4ed8;
    
    --radius-2xl: 26px;
    --radius-xl: 18px;
    --radius-lg: 14px;
}

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

body {
    font-family: 'Kanit', 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    background-image: 
        radial-gradient(at 10% 12%, rgba(186, 230, 253, 0.7) 0px, transparent 50%),
        radial-gradient(at 88% 10%, rgba(191, 219, 254, 0.6) 0px, transparent 55%),
        radial-gradient(at 50% 45%, rgba(224, 242, 254, 0.5) 0px, transparent 60%),
        radial-gradient(at 80% 85%, rgba(147, 197, 253, 0.4) 0px, transparent 50%);
    background-attachment: fixed;
}

/* ── 3D Grid Canvas Background (Light Soft Blueprint Style) ── */
.lab-grid-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-size: 55px 55px;
    background-image: 
        linear-gradient(to right, rgba(59, 130, 246, 0.06) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(59, 130, 246, 0.06) 1px, transparent 1px);
    pointer-events: none;
    z-index: 0;
}

/* ── Ambient Glowing Blue Orbs (Light Mode) ── */
.glow-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.65;
    animation: orbFloat 18s ease-in-out infinite alternate;
}

.glow-orb-1 {
    width: 480px;
    height: 480px;
    top: -100px;
    left: 10%;
    background: radial-gradient(circle, rgba(147, 197, 253, 0.7), rgba(96, 165, 250, 0.2));
}

.glow-orb-2 {
    width: 420px;
    height: 420px;
    bottom: 5%;
    right: 5%;
    background: radial-gradient(circle, rgba(186, 230, 253, 0.8), rgba(37, 99, 235, 0.15));
    animation-delay: -9s;
}

@keyframes orbFloat {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(35px, 25px) scale(1.08); }
    100% { transform: translate(-25px, 50px) scale(0.96); }
}

/* ── HERO LAB STUDIO ── */
.hero {
    position: relative;
    z-index: 10;
    padding: 3.5rem 1.5rem 2.2rem;
    text-align: center;
    max-width: 1200px;
    margin: 0 auto;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.2rem;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 1.35rem;
    background: rgba(255, 255, 255, 0.85);
    border: 1.5px solid rgba(191, 219, 254, 0.8);
    border-radius: 999px;
    color: #1d4ed8;
    font-size: 0.95rem;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.08);
    backdrop-filter: blur(12px);
    transition: all 0.3s ease;
    text-decoration: none;
}

.back-btn:hover {
    background: #ffffff;
    border-color: #3b82f6;
    color: #1e40af;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.18);
    transform: translateX(-3px);
}

.studio-status {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(239, 246, 255, 0.9);
    border: 1.5px solid rgba(147, 197, 253, 0.8);
    padding: 0.45rem 1.15rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-family: 'Fira Code', monospace;
    font-weight: 700;
    color: #1d4ed8;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.pulse-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: #2563eb;
    box-shadow: 0 0 10px #3b82f6;
    animation: statusPulse 1.8s infinite;
}

@keyframes statusPulse {
    0% { transform: scale(0.9); opacity: 0.6; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.6; }
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1.4rem;
    background: linear-gradient(90deg, #dbeafe, #eff6ff);
    border: 1.5px solid #bfdbfe;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 800;
    color: #1e40af;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 1.2rem;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.08);
}

.hero h1 {
    font-size: clamp(2.4rem, 5vw, 3.8rem);
    font-weight: 800;
    line-height: 1.18;
    margin-bottom: 0.8rem;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #0284c7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
    drop-shadow: 0 2px 4px rgba(37, 99, 235, 0.1);
}

.hero h1 span {
    display: block;
    font-size: clamp(1.2rem, 2.5vw, 1.75rem);
    font-weight: 600;
    background: linear-gradient(135deg, #3b82f6, #0284c7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-top: 0.4rem;
}

.subtitle {
    color: #475569;
    font-size: 1.12rem;
    max-width: 650px;
    margin: 0 auto 2.2rem;
    line-height: 1.6;
    font-weight: 500;
}

/* ── STATS DASHBOARD BAR (Light Theme) ── */
.lab-stats-row {
    display: flex;
    justify-content: center;
    gap: 1.4rem;
    margin-bottom: 2.2rem;
    flex-wrap: wrap;
}

.lab-stat-chip {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    background: rgba(255, 255, 255, 0.9);
    border: 1.5px solid rgba(191, 219, 254, 0.9);
    backdrop-filter: blur(12px);
    padding: 0.7rem 1.6rem;
    border-radius: var(--radius-xl);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.06), inset 0 1px 0 rgba(255, 255, 255, 1);
    transition: transform 0.25s ease;
}

.lab-stat-chip:hover {
    transform: translateY(-2px);
    border-color: #60a5fa;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.12);
}

.stat-icon {
    font-size: 1.4rem;
}

.stat-val {
    font-size: 1.25rem;
    font-weight: 800;
    color: #1e3a8a;
}

.stat-label {
    font-size: 0.82rem;
    color: #64748b;
    font-weight: 600;
}

/* ── SEARCH & FILTER CONTROLS ── */
.controls-container {
    max-width: 880px;
    margin: 0 auto 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.search-wrap {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 1.4rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.3rem;
    color: #2563eb;
    pointer-events: none;
    transition: all 0.3s;
}

.search-wrap input {
    width: 100%;
    padding: 1.15rem 1.6rem 1.15rem 3.6rem;
    background: #ffffff;
    border: 2px solid #bfdbfe;
    border-radius: 999px;
    font-size: 1.05rem;
    font-family: inherit;
    color: #0f172a;
    outline: none;
    box-shadow: 0 8px 30px rgba(37, 99, 235, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-wrap input::placeholder {
    color: #94a3b8;
}

.search-wrap input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15), 0 12px 35px rgba(37, 99, 235, 0.15);
}

/* ── CATEGORY PILL FILTERS (Light Theme) ── */
.category-filter-bar {
    display: flex;
    justify-content: center;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.65rem 1.4rem;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.85);
    border: 1.5px solid #bfdbfe;
    color: #1e40af;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.04);
    transition: all 0.25s ease;
    backdrop-filter: blur(8px);
}

.filter-btn:hover {
    background: #ffffff;
    border-color: #3b82f6;
    color: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.12);
}

.filter-btn.active {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 50%, #0284c7 100%);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

/* ── MAIN CONTAINER & GRID ── */
.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 5rem;
    position: relative;
    z-index: 10;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1.5px solid #dbeafe;
}

.section-heading h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1e3a8a;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.live-count-badge {
    font-size: 0.9rem;
    font-family: 'Fira Code', monospace;
    font-weight: 700;
    background: #e0f2fe;
    border: 1.5px solid #bae6fd;
    color: #0369a1;
    padding: 0.35rem 0.95rem;
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.08);
}

/* ── 3D LAB TOPIC GRID ── */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 1.8rem;
}

/* ── 3D VIRTUAL LAB CARD (Clean Light Glassmorphism) ── */
.topic-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1.5px solid #dbeafe;
    border-radius: var(--radius-2xl);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.07), 0 8px 10px -6px rgba(37, 99, 235, 0.04), inset 0 1px 0 rgba(255, 255, 255, 1);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
}

.topic-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #38bdf8, #2563eb, #0284c7);
    opacity: 0;
    transition: opacity 0.3s;
}

.topic-card:hover {
    transform: translateY(-8px) scale(1.015);
    background: #ffffff;
    border-color: #60a5fa;
    box-shadow: 0 20px 40px -10px rgba(37, 99, 235, 0.18), 0 0 0 1px rgba(59, 130, 246, 0.2);
}

.topic-card:hover::before {
    opacity: 1;
}

.topic-card.hidden {
    display: none !important;
}

/* Card Header with Soft Blue Ambient Halo */
.card-icon-wrap {
    height: 105px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
    border-bottom: 1.5px solid #e0e7ff;
}

.card-icon-wrap::after {
    content: '';
    position: absolute;
    width: 95px;
    height: 95px;
    background: radial-gradient(circle, rgba(191, 219, 254, 0.65), transparent 70%);
    border-radius: 50%;
    filter: blur(12px);
    opacity: 0.7;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.topic-card:hover .card-icon-wrap::after {
    transform: scale(1.7);
    opacity: 1;
    background: radial-gradient(circle, rgba(147, 197, 253, 0.8), transparent 70%);
}

.card-icon {
    font-size: 3.1rem;
    z-index: 2;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 4px 8px rgba(37, 99, 235, 0.15));
}

.topic-card:hover .card-icon {
    transform: scale(1.18) rotate(4deg);
}

/* Floating corner number */
.card-num {
    position: absolute;
    top: 14px;
    right: 16px;
    font-family: 'Fira Code', monospace;
    font-size: 0.82rem;
    font-weight: 800;
    color: #1e40af;
    background: #dbeafe;
    border: 1px solid #bfdbfe;
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    z-index: 3;
    box-shadow: 0 2px 5px rgba(37, 99, 235, 0.08);
}

/* Card Body */
.card-body {
    padding: 1.5rem 1.6rem 1.2rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-tag {
    display: inline-block;
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #0284c7;
    margin-bottom: 0.35rem;
}

.card-title-en {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.2rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.35;
    margin-bottom: 0.25rem;
    transition: color 0.2s;
}

.topic-card:hover .card-title-en {
    color: #2563eb;
}

.card-title-th {
    font-size: 1.05rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 1rem;
}

/* Sub-list (hidden on cards, parsed by modal) */
.card-sub-list {
    display: none;
}

/* Card Footer */
.card-footer {
    padding: 1.1rem 1.6rem;
    background: #f8fafc;
    border-top: 1.5px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.92rem;
    font-weight: 600;
    color: #64748b;
}

.card-count {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #3b82f6;
    font-weight: 700;
}

.card-count::before {
    content: '⚡';
    font-size: 0.9rem;
}

.card-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.88rem;
    font-weight: 700;
    color: #1d4ed8;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    background: #eff6ff;
    border: 1.5px solid #bfdbfe;
    transition: all 0.25s ease;
}

.topic-card:hover .card-action-btn {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.35);
    transform: translateX(3px);
}

/* Color variations on light mode */
.c-blue, .c-green, .c-orange, .c-purple, .c-teal, .c-red {
    --card-border: #dbeafe;
    --card-hover-border: #3b82f6;
    --card-hover-glow: rgba(59, 130, 246, 0.18);
}

/* ── 3D LAB LAUNCHER MODAL (LIGHT MODE GLASS STUDIO) ── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 1.5rem;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: #ffffff;
    border: 2px solid #bfdbfe;
    border-radius: 28px;
    padding: 35px;
    width: 100%;
    max-width: 560px;
    box-shadow: 0 25px 60px -12px rgba(30, 58, 138, 0.25), 0 0 0 1px rgba(255, 255, 255, 1) inset;
    transform: translateY(30px) scale(0.94);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    top: 22px;
    right: 22px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    color: #475569;
    transition: all 0.25s ease;
}

.modal-close:hover {
    background: #fee2e2;
    color: #ef4444;
    border-color: #fca5a5;
    transform: rotate(90deg);
}

.modal-header {
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 2px dashed #e2e8f0;
    padding-right: 40px;
}

.modal-title-wrap h3 {
    font-size: 1.65rem;
    font-weight: 800;
    background: linear-gradient(135deg, #1e3a8a, #2563eb, #0284c7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.25;
    margin-bottom: 4px;
}

.modal-title-wrap p {
    font-size: 1.15rem;
    font-weight: 700;
    color: #334155;
    margin: 0;
}

.modal-body {
    overflow-y: auto;
    padding-right: 8px;
}

.modal-body ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-body ul::-webkit-scrollbar {
    width: 6px;
}

.modal-body ul::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 10px;
}

.modal-body ul::-webkit-scrollbar-thumb {
    background: #93c5fd;
    border-radius: 10px;
}

.modal-body a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: var(--radius-xl);
    color: #1e293b;
    font-size: 1.05rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.modal-body a::before {
    content: '🔬';
    margin-right: 14px;
    font-size: 1.35rem;
    transition: transform 0.3s ease;
}

.modal-body a::after {
    content: 'OPEN ➔';
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    font-weight: 800;
    color: #1d4ed8;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    background: #dbeafe;
    border: 1px solid #bfdbfe;
    margin-left: auto;
    transition: all 0.25s ease;
}

.modal-body a:hover {
    background: #ffffff;
    border-color: #3b82f6;
    color: #1d4ed8;
    transform: translateX(6px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.15);
}

.modal-body a:hover::before {
    transform: scale(1.25) rotate(-10deg);
}

.modal-body a:hover::after {
    background: #2563eb;
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.4);
}

/* ── NO RESULTS STATE ── */
#no-results {
    display: none;
    text-align: center;
    padding: 5rem 1rem;
    color: #64748b;
}

.no-icon {
    font-size: 3.5rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.6;
}

/* ── FOOTER ── */
footer {
    text-align: center;
    padding: 2.5rem 1.5rem;
    background: #ffffff;
    border-top: 1.5px solid #e2e8f0;
    color: #64748b;
    font-size: 0.95rem;
    position: relative;
    z-index: 10;
}

footer strong {
    color: #1e3a8a;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    .hero { padding: 2.5rem 1rem 1.5rem; }
    .hero h1 { font-size: 2.2rem; }
    .top-bar { margin-bottom: 1.5rem; }
    .topic-grid { grid-template-columns: 1fr; }
    .category-filter-bar { overflow-x: auto; justify-content: flex-start; padding-bottom: 0.5rem; }
    .lab-stats-row { gap: 0.8rem; }
    .modal-content { padding: 25px; }
}
