@charset "UTF-8";
@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #0f2027;
    --primary-light: #203a43;
    --primary-dark: #0a1318;
    --accent: #d97706;
    --accent-light: #f59e0b;
    --accent-soft: #fef3c7;
    --surface: #ffffff;
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #0284c7;
    --font-heading: 'Prompt', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Sarabun', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --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-hover: 0 12px 20px -2px rgba(15, 32, 39, 0.15);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
}

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

html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-main);
    background-color: var(--bg-page);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--primary);
    line-height: 1.3;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    color: var(--primary);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    color: #fff;
    padding: 12px 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.nav-brand-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.2rem;
    white-space: nowrap;
    text-decoration: none;
}

.nav-brand:hover {
    color: var(--accent-light);
}

.nav-brand .brand-badge {
    background: var(--accent);
    color: #fff;
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: 600;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Hamburger Toggle Button */
.nav-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    padding: 7px 8px;
    border-radius: var(--radius-sm);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 38px;
    height: 36px;
    transition: all 0.2s;
}

.nav-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.hamburger-bar {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

.nav-toggle.active .hamburger-bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.nav-toggle.active .hamburger-bar:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active .hamburger-bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 12px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links li {
    display: inline-flex;
    align-items: center;
}

.nav-links a {
    color: #e2e8f0;
    font-family: var(--font-heading);
    font-size: 0.92rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.nav-links a.btn-login {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    border-radius: 999px;
    padding: 6px 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.nav-links a.btn-login:hover {
    background: var(--accent-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
}

.user-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    color: #fff;
    white-space: nowrap;
}

/* Language Switch Capsule Pill */
.lang-switch-item {
    display: inline-flex;
    align-items: center;
}

.lang-switch-pill {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 2px 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    white-space: nowrap;
}

.lang-switch-pill a.lang-btn {
    padding: 3px 9px !important;
    border-radius: 999px !important;
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    color: #cbd5e1 !important;
    text-decoration: none !important;
    transition: all 0.2s ease;
}

.lang-switch-pill a.lang-btn:hover {
    color: #fff !important;
}

.lang-switch-pill a.lang-btn.active-th {
    background: #d97706 !important;
    color: #ffffff !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.lang-switch-pill a.lang-btn.active-en {
    background: #059669 !important;
    color: #ffffff !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, rgba(15, 32, 39, 0.95) 0%, rgba(32, 58, 67, 0.9) 100%),
                radial-gradient(circle at 80% 20%, rgba(217, 119, 6, 0.3) 0%, transparent 60%);
    color: #fff;
    padding: 45px 0 50px;
    text-align: center;
    border-bottom: 4px solid var(--accent);
}

.hero h1 {
    color: #fff;
    font-size: 2.2rem;
    margin-bottom: 12px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.hero p {
    color: #cbd5e1;
    font-size: 1.05rem;
    max-width: 720px;
    margin: 0 auto 25px;
    line-height: 1.7;
}

.search-box-wrap {
    max-width: 760px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px;
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
}

.search-box-form {
    display: flex;
    gap: 8px;
    background: #fff;
    padding: 6px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px 16px;
    font-size: 1rem;
    font-family: var(--font-body);
    color: var(--text-main);
}

.search-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-btn:hover {
    background: var(--accent-light);
}

/* Stats Ribbon */
.stats-ribbon {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.stat-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.15);
    text-align: center;
}

.stat-num {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-light);
}

.stat-label {
    font-size: 0.82rem;
    color: #cbd5e1;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 35px 0 60px;
}

/* Filter Bar */
.filter-bar {
    background: var(--surface);
    padding: 18px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-label {
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.filter-select {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text-main);
    outline: none;
    cursor: pointer;
}

.filter-select:focus {
    border-color: var(--accent);
}

/* Topics Grid */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 22px;
    margin-bottom: 35px;
}

.topic-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.topic-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(217, 119, 6, 0.4);
}

.topic-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.2s;
}

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

.card-meta-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    font-size: 0.8rem;
    gap: 8px;
    flex-wrap: wrap;
}

.topic-volume-badge {
    background: #eff6ff;
    color: #1d4ed8;
    padding: 3px 9px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.78rem;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.topic-category-badge {
    background: var(--accent-soft);
    color: #92400e;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.78rem;
    white-space: normal;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: none;
    line-height: 1.4;
    text-align: left;
    transition: all 0.2s ease;
}

/* หมวดหมู่พืชและธรรมชาติ */
.topic-category-badge.cat-plant {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* หมวดหมู่วัฒนธรรมและภูมิปัญญา */
.topic-category-badge.cat-culture {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* หมวดหมู่นิทาน ตำนาน วรรณกรรม */
.topic-category-badge.cat-literature {
    background: #f3e8ff;
    color: #6b21a8;
    border: 1px solid #e9d5ff;
}

/* หมวดหมู่การเล่น กีฬา */
.topic-category-badge.cat-game {
    background: #ffedd5;
    color: #9a3412;
    border: 1px solid #fed7aa;
}

/* หมวดหมู่อาหาร */
.topic-category-badge.cat-food {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.topic-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 6px;
    line-height: 1.4;
}

.topic-title a {
    color: inherit;
}

.topic-title a:hover {
    color: var(--accent);
}

.topic-title-en {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 12px;
    line-height: 1.3;
}

.topic-summary {
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.55;
    margin-bottom: 18px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 14px;
    border-top: 1px dashed var(--border);
    font-size: 0.82rem;
    color: var(--text-muted);
}

.btn-read-more {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--accent);
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 0.88rem;
}

.btn-read-more:hover {
    color: var(--primary);
    transform: translateX(2px);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s;
}

.page-link:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: #fff;
}

.page-link.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.page-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-left: 10px;
}

/* Detail View */
.detail-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: 30px;
}

.detail-header {
    background: linear-gradient(135deg, #0f2027 0%, #203a43 100%);
    color: #fff;
    padding: 35px 35px 30px;
    position: relative;
    border-bottom: 4px solid var(--accent);
}

.detail-header h1 {
    color: #fff;
    font-size: 2rem;
    margin-bottom: 6px;
}

.detail-header-en {
    color: #94a3b8;
    font-size: 1.1rem;
    font-style: italic;
    margin-bottom: 18px;
}

.detail-meta-pills {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    color: #e2e8f0;
}

.meta-pill.highlight {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.detail-body {
    padding: 35px;
}

.detail-section {
    margin-bottom: 30px;
}

.section-title {
    font-size: 1.15rem;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
}

.detail-summary-box {
    background: #f8fafc;
    border-left: 4px solid var(--accent);
    padding: 18px 22px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin-bottom: 25px;
    font-size: 1.05rem;
    line-height: 1.7;
    color: #334155;
}

.detail-content-text {
    font-size: 1.05rem;
    line-height: 1.75;
    color: #1e293b;
}

.detail-content-text p {
    margin: 0 0 10px 0;
    line-height: 1.75;
    text-align: justify;
}

.detail-content-text p:last-child {
    margin-bottom: 0;
}

.detail-summary-box p {
    margin: 0 0 8px 0;
    line-height: 1.65;
}

.detail-summary-box p:last-child {
    margin-bottom: 0;
}

.quote-box {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fde68a;
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin: 25px 0;
    position: relative;
}

.quote-box p {
    font-style: italic;
    color: #78350f;
    font-size: 1rem;
    line-height: 1.6;
}

.museum-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    background: #f1f5f9;
    padding: 20px;
    border-radius: var(--radius-md);
    margin-top: 20px;
}

.info-item label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    display: block;
    margin-bottom: 2px;
}

.info-item span {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--primary);
}

/* Forms & Admin */
.admin-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 25px;
    margin-bottom: 25px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-light);
    color: #fff;
}

.btn-accent {
    background: var(--accent);
    color: #fff;
}

.btn-accent:hover {
    background: var(--accent-light);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
    color: #fff;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}

/* Table */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.data-table th {
    background: #f8fafc;
    color: var(--primary);
    font-family: var(--font-heading);
    font-weight: 600;
    padding: 12px 14px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tr:hover td {
    background-color: #f8fafc;
}

/* Form inputs */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 0.92rem;
    color: var(--primary);
}

.form-control {
    width: 100%;
    padding: 9px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-main);
    background: #fff;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

/* Alert boxes */
.alert {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-info {
    background: #e0f2fe;
    color: #075985;
    border: 1px solid #bae6fd;
}

/* Login Card */
.login-wrap {
    max-width: 440px;
    margin: 40px auto;
}

.login-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 35px 30px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 25px;
}

.login-header h2 {
    font-size: 1.6rem;
    color: var(--primary);
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

.login-hints {
    background: #f8fafc;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-top: 20px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* Footer */
.footer {
    background: #0a1318;
    color: #94a3b8;
    padding: 35px 0 25px;
    margin-top: auto;
    font-size: 0.88rem;
    border-top: 3px solid var(--accent);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-brand {
    font-family: var(--font-heading);
    font-weight: 600;
    color: #fff;
    font-size: 1.1rem;
}

.footer-brand span {
    color: var(--accent-light);
}

/* Mobile responsive */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }
    .container {
        padding: 0 14px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    .navbar {
        padding: 10px 0;
        width: 100%;
        overflow-x: hidden;
    }
    .navbar .container {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: stretch !important;
        gap: 0 !important;
        width: 100% !important;
        padding: 0 12px !important;
        box-sizing: border-box !important;
    }
    .nav-brand-wrap {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
    }
    .nav-toggle {
        display: flex !important;
    }
    .nav-brand {
        font-size: 1.05rem !important;
        gap: 6px !important;
        white-space: normal !important;
        flex: 1 !important;
        text-align: left !important;
        justify-content: flex-start !important;
    }
    .nav-brand .brand-badge {
        font-size: 0.65rem !important;
        padding: 2px 6px !important;
        white-space: nowrap !important;
    }

    /* เมนูย่อแบบแฮมเบอร์เกอร์บนมือถือ (Hamburger Dropdown) */
    .nav-links {
        display: none !important;
        flex-direction: column !important;
        width: 100% !important;
        margin-top: 10px !important;
        padding: 14px 16px !important;
        background: rgba(15, 32, 39, 0.98) !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        border-radius: var(--radius-md) !important;
        box-shadow: 0 14px 28px rgba(0, 0, 0, 0.5) !important;
        gap: 8px !important;
        box-sizing: border-box !important;
    }

    .nav-links.open {
        display: flex !important;
        animation: navSlideDown 0.22s ease-out !important;
    }

    @keyframes navSlideDown {
        from { opacity: 0; transform: translateY(-8px); }
        to { opacity: 1; transform: translateY(0); }
    }

    .nav-links li {
        width: 100% !important;
        display: block !important;
    }

    .nav-links a {
        display: flex !important;
        align-items: center !important;
        width: 100% !important;
        padding: 10px 14px !important;
        font-size: 0.95rem !important;
        border-radius: var(--radius-sm) !important;
        box-sizing: border-box !important;
        background: rgba(255, 255, 255, 0.05);
    }

    .nav-links a:hover,
    .nav-links a.active {
        background: rgba(255, 255, 255, 0.15) !important;
    }

    .nav-links a.btn-login {
        justify-content: center !important;
        padding: 11px 16px !important;
        font-size: 0.95rem !important;
        border-radius: 999px !important;
        background: var(--accent) !important;
        color: #fff !important;
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3) !important;
    }

    .lang-switch-item {
        margin-top: 6px;
        padding-top: 10px;
        border-top: 1px dashed rgba(255, 255, 255, 0.15);
        display: flex !important;
        justify-content: center !important;
        width: 100%;
    }

    .lang-switch-pill {
        display: inline-flex !important;
        padding: 3px 6px !important;
        width: auto !important;
    }

    .lang-switch-pill a.lang-btn {
        padding: 5px 14px !important;
        font-size: 0.85rem !important;
        white-space: nowrap !important;
    }

    .user-badge {
        display: flex !important;
        width: 100% !important;
        justify-content: center !important;
        padding: 10px 12px !important;
        font-size: 0.85rem !important;
        box-sizing: border-box !important;
        background: rgba(255, 255, 255, 0.1) !important;
    }
    .hero {
        padding: 40px 0 35px;
    }
    .hero h1 {
        font-size: 1.55rem;
    }
    .hero p {
        font-size: 0.92rem;
    }
    .search-box-form {
        flex-direction: column;
        padding: 8px;
    }
    .search-input {
        width: 100%;
        padding: 10px 12px;
    }
    .search-btn {
        width: 100%;
        justify-content: center;
        padding: 11px;
    }
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 14px;
    }
    .filter-group {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    .filter-select {
        width: 100%;
    }
    .detail-body {
        padding: 22px 16px;
    }
    .detail-header {
        padding: 25px 16px;
    }
    .detail-header h1 {
        font-size: 1.55rem;
    }
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    .footer-content > div:last-child {
        text-align: center !important;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    .nav-brand {
        font-size: 1.02rem;
        gap: 6px;
    }
    .nav-brand .brand-badge {
        font-size: 0.65rem;
        padding: 1px 6px;
    }
    .nav-links {
        gap: 6px 6px;
    }
    .nav-links a {
        font-size: 0.82rem;
        padding: 5px 10px;
    }
    .nav-links a.btn-login {
        font-size: 0.82rem;
        padding: 5px 12px;
    }
    .lang-switch-pill a.lang-btn {
        padding: 3px 7px !important;
        font-size: 0.72rem !important;
    }
    .stats-ribbon {
        gap: 8px;
        margin-top: 20px;
    }
    .stat-item {
        flex: 1 1 calc(50% - 8px);
        min-width: 110px;
        padding: 8px 10px;
    }
    .stat-num {
        font-size: 1.25rem;
    }
    .meta-pill {
        font-size: 0.78rem;
        padding: 4px 10px;
    }
}

/* ========================================================
   Gallery Grid & Lightbox Popup
   ======================================================== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.gallery-item {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.gallery-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
}

.gallery-thumb-wrap {
    height: 190px;
    overflow: hidden;
    background: #f1f5f9;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-thumb-wrap img {
    transform: scale(1.05);
}

.gallery-zoom-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(15, 23, 42, 0.75);
    color: #fff;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    gap: 4px;
}

.gallery-caption {
    background: #fff;
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-muted);
    flex: 1;
    line-height: 1.4;
}

/* Smartphone Display: 2 Columns flowing downwards */
@media (max-width: 640px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    .gallery-thumb-wrap {
        height: 130px !important;
    }
    .gallery-caption {
        padding: 6px 8px !important;
        font-size: 0.75rem !important;
        line-height: 1.3 !important;
    }
    .gallery-zoom-badge {
        font-size: 0.65rem !important;
        padding: 2px 6px !important;
    }
}

/* Lightbox Modal */
.image-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 19, 24, 0.9);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 15px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.image-modal.show {
    display: flex;
    opacity: 1;
}

.image-modal-content {
    position: relative;
    max-width: 92vw;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: modalZoom 0.25s ease-out;
}

@keyframes modalZoom {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.image-modal-img {
    max-width: 100%;
    max-height: 75vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    background: #000;
}

.image-modal-info {
    width: 100%;
    max-width: 700px;
    margin-top: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: #1e293b;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 0.92rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    box-shadow: var(--shadow-md);
}

.image-modal-caption {
    font-weight: 500;
    color: #0f172a;
    flex: 1;
    text-align: left;
}

.image-modal-counter {
    font-size: 0.8rem;
    color: #64748b;
    background: #e2e8f0;
    padding: 3px 10px;
    border-radius: 999px;
}

.image-modal-r2link {
    font-size: 0.8rem;
    color: var(--accent);
    text-decoration: underline;
    margin-left: 8px;
}

.image-modal-close {
    position: absolute;
    top: -45px;
    right: 0;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.2s, transform 0.2s;
}

.image-modal-close:hover {
    background: #ef4444;
    transform: scale(1.1);
}

.image-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    border: none;
    font-size: 26px;
    cursor: pointer;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    user-select: none;
}

.image-modal-nav:hover {
    background: var(--accent);
    transform: translateY(-50%) scale(1.1);
}

.image-modal-prev {
    left: -58px;
}

.image-modal-next {
    right: -58px;
}

@media (max-width: 640px) {
    .image-modal-prev {
        left: 5px;
        background: rgba(0, 0, 0, 0.6);
    }
    .image-modal-next {
        right: 5px;
        background: rgba(0, 0, 0, 0.6);
    }
    .image-modal-close {
        top: -40px;
        right: 5px;
    }
    .image-modal-img {
        max-height: 65vh;
    }
    .image-modal-info {
        font-size: 0.8rem;
        padding: 8px 12px;
    }
}
