/* ==========================================================================
   style.css - ระบบสไตล์ระดับพรีเมียม (ม่วง-เหลือง, Light/Dark Mode, Glassmorphism)
   โรงเรียนเวียงเชียงรุ้งวิทยาคม - EQA มาตรฐานที่ 3
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Kanit:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Roboto:wght@300;400;500;700&display=swap');

:root {
    /* 1. โทนสีและสไตล์ระบบ (โหมดสว่าง - Default Light Mode) */
    --primary: #5c2d91;         /* สีม่วงประธานสถาบัน */
    --primary-light: #7b42bd;   /* สีม่วงอ่อนสำหรับโฮเวอร์ */
    --primary-glow: rgba(92, 45, 145, 0.15);
    --accent: #ffc82c;          /* สีเหลืองทองนำสมัย */
    --accent-light: #ffe082;
    --accent-glow: rgba(255, 200, 44, 0.2);
    
    --bg-main: #f5f4fa;         /* พื้นหลังใหญ่ */
    --bg-surface: rgba(255, 255, 255, 0.85); /* พื้นผิว Glassmorphism */
    --bg-sidebar: #221236;      /* สีพื้นหลังแถบข้างหรูหรา (ม่วงเข้มจักรพรรดิ) */
    
    --text-main: #2b233a;       /* สีตัวอักษรหลัก */
    --text-muted: #6e6480;      /* สีตัวอักษรรอง */
    --text-on-sidebar: #f0eaf7; /* ตัวอักษรบนพื้นเข้ม */
    
    --border: rgba(92, 45, 145, 0.1);
    --border-glass: rgba(255, 255, 255, 0.25);
    
    --shadow-sm: 0 4px 6px -1px rgba(92, 45, 145, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(92, 45, 145, 0.08), 0 4px 6px -2px rgba(92, 45, 145, 0.03);
    --shadow-lg: 0 20px 25px -5px rgba(92, 45, 145, 0.12), 0 10px 10px -5px rgba(92, 45, 145, 0.04);
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --sub-indicator-color: #1a56db;   /* สีฟ้าเข้มพรีเมียมสำหรับหัวข้อย่อย */
}

/* 2. ระบบปรับสีเป็นโหมดมืด (Dark Mode Overrides) */
[data-theme="dark"] {
    --bg-main: #0c0715;         /* ดำม่วงอวกาศ */
    --bg-surface: rgba(24, 18, 38, 0.9);
    --bg-sidebar: #07030c;
    
    --text-main: #ede7f5;
    --text-muted: #a399b8;
    --text-on-sidebar: #ede7f5;
    
    --border: rgba(255, 200, 44, 0.1);
    --border-glass: rgba(24, 18, 38, 0.3);
    
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    
    --primary: #9b6bc5;
    --primary-light: #b388eb;
    --primary-glow: rgba(155, 107, 197, 0.25);
    
    --accent: #ffd54f;
    --accent-light: #ffe082;
    --accent-glow: rgba(255, 213, 79, 0.3);
    --sub-indicator-color: #5eead4;   /* สีฟ้าสว่างพรีเมียมสำหรับหัวข้อย่อยในโหมดมืด */
}

/* ==========================================================================
   3. สไตล์โครงสร้างหลักของหน้า (Base Structure & Reset)
   ========================================================================== */

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

body {
    font-family: 'Kanit', 'Roboto', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    transition: var(--transition);
}

.app-container {
    display: flex;
    width: 100vw;
    min-height: 100vh;
    position: relative;
}

/* ==========================================================================
   4. สไตล์ Sidebar ด้านข้าง (Sidebar Navigation & Collapsible Accordion)
   ========================================================================== */

.sidebar {
    width: 320px;
    background-color: var(--bg-sidebar);
    color: var(--text-on-sidebar);
    display: flex;
    flex-direction: column;
    padding: 32px 20px;
    flex-shrink: 0;
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.15);
    z-index: 100;
    transition: var(--transition);
    overflow-y: auto;
    max-height: 100vh;
}

/* โลโก้สถาบัน */
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 24px;
}

.school-logo {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent), var(--primary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #221236;
    font-size: 18px;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(255, 200, 44, 0.3);
    border: 2px solid var(--accent);
    overflow: hidden; /* Ensure image doesn't overflow circular bounds */
}

.school-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    background-color: #fff; /* White background to make the logo crest stand out */
    padding: 1px;
}

.school-info h2 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.5px;
    line-height: 1.3;
}

.school-info p {
    font-size: 10px;
    color: var(--accent);
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 1px;
    margin-top: 2px;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.menu-title {
    font-size: 11px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 1px;
    margin: 16px 0 8px 8px;
    font-weight: 600;
}

/* เมนูไอเทมปกติและหัวข้อ */
.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 500;
    transition: var(--transition);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid transparent;
}

.menu-item i {
    font-size: 15px;
    width: 20px;
    text-align: center;
}

.menu-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.menu-item.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 6px 15px rgba(92, 45, 145, 0.2);
}

.menu-item.active i {
    color: var(--accent);
}

/* 4.1 สไตล์ Accordion แถบข้างเมนูใหญ่ */
.accordion-wrapper {
    display: flex;
    flex-direction: column;
    background-color: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.03);
    overflow: hidden;
    margin-bottom: 6px;
}

.accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    transition: var(--transition);
    background-color: rgba(255, 255, 255, 0.02);
}

.accordion-header:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.accordion-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.accordion-header-title i {
    font-size: 14px;
    color: var(--accent);
    width: 20px;
    text-align: center;
}

.accordion-arrow {
    font-size: 10px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.5;
}

/* การหมุนหัวลูกศรตามสเตทขยาย */
.accordion-wrapper.expanded .accordion-arrow {
    transform: rotate(90deg);
    opacity: 0.9;
}

/* คอนเทนเนอร์รายการย่อย (Submenu container) */
.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 4px;
    background-color: rgba(0, 0, 0, 0.1);
}

.accordion-wrapper.expanded .accordion-content {
    max-height: 1000px; /* เพิ่มความสูงเผื่อเพื่อไม่ให้หัวข้อย่อยยาวๆ โดนตัดขอบ (เช่น มาตรฐาน 2 มี 10 ข้อ) */
    padding: 6px 4px;
}

/* รายการเมนูย่อย (Submenu Item) */
.sub-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sub-menu-item:hover {
    background-color: rgba(255, 255, 255, 0.04);
    color: #fff;
    border-left-color: var(--accent-light);
}

.sub-menu-item.active {
    background-color: rgba(92, 45, 145, 0.2);
    color: #fff;
    border-left-color: var(--accent);
    font-weight: 600;
}

.sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 24px;
}

.admin-link-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background-color: rgba(255, 200, 44, 0.06);
    border: 1.5px dashed var(--accent);
    color: var(--accent);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
}

.admin-link-btn:hover {
    background-color: var(--accent);
    color: #221236;
    border-style: solid;
    box-shadow: 0 4px 15px rgba(255, 200, 44, 0.25);
    transform: translateY(-2px);
}

/* ==========================================================================
   5. พื้นที่คอนเทนต์หลัก (Main Workspace Area)
   ========================================================================== */

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 40px;
    height: 100vh;
    overflow-y: auto;
    position: relative;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    gap: 20px;
}

.welcome-box h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-box p {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 4px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.btn-icon:hover {
    color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.search-wrapper {
    position: relative;
    width: 260px;
}

.search-wrapper i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
}

.search-input {
    width: 100%;
    height: 42px;
    padding: 10px 14px 10px 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background-color: var(--bg-surface);
    color: var(--text-main);
    font-family: inherit;
    font-size: 12.5px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ==========================================================================
   6. การตกแต่งแผงแดชบอร์ดหน้าแรก (Home Dashboard Panel Styles)
   ========================================================================== */

/* แผงสถิติรวมของโรงเรียน */
.stats-overview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 12px;
}

.stats-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(8px);
    transition: var(--transition);
}

.stats-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.stats-card-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
}

.stats-card-info h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.stats-card-info p {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* แผงคีย์ทางลัด */
.home-quicklinks-section {
    display: flex;
    flex-direction: column;
    margin-top: 16px;
}

.quicklinks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.quicklink-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(8px);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.quicklink-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: linear-gradient(to bottom, var(--primary), var(--primary-light));
    opacity: 0.7;
}

.quicklink-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.quicklink-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quicklink-card-header h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

.quicklink-card-header span {
    font-size: 10px;
    background-color: var(--accent-glow);
    color: #b78a00;
    padding: 4px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.quicklink-card p {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: justify;
}

.quicklink-card-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--primary);
    margin-top: auto;
    transition: var(--transition);
}

.quicklink-card:hover .quicklink-card-footer {
    color: var(--primary-light);
    transform: translateX(4px);
}

/* ==========================================================================
   7. บอร์ดข้อมูลของตัวชี้วัด (Indicator Board Layout)
   ========================================================================== */

.indicator-board {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 40px;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-lg);
    margin-bottom: 24px;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 28px;
    animation: fadeIn 0.4s ease-in-out;
}

.board-banner {
    background: linear-gradient(135deg, rgba(92, 45, 145, 0.05), rgba(255, 200, 44, 0.03));
    border-left: 5px solid var(--primary);
    padding: 20px 28px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.board-banner h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.board-banner p {
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text-muted);
    margin-top: 10px;
    text-align: justify;
}

.board-tabs {
    display: flex;
    gap: 16px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 12px;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn i {
    font-size: 14px;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -14px;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: var(--primary);
    border-radius: 2px;
    box-shadow: 0 -2px 10px var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

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

/* ==========================================================================
   8. แท็บเอกสาร PDF (PDF Grid & Card Style)
   ========================================================================== */

.pdf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.pdf-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(8px);
}

.pdf-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

/* ==========================================================================
   สไตล์แสดงผลปกหน้าแรกของ PDF อัตโนมัติ (PDF Cover Page Thumbnail Preview)
   ========================================================================== */
.pdf-thumbnail-wrapper {
    width: 100%;
    height: 180px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    background-color: rgba(220, 53, 69, 0.03);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.pdf-card:hover .pdf-thumbnail-wrapper {
    border-color: var(--primary-light);
    background-color: rgba(220, 53, 69, 0.05);
}

.pdf-thumbnail-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
    pointer-events: none;
}

.pdf-thumbnail-canvas {
    max-width: 100%;
    max-height: 100%;
    display: block;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    z-index: 1;
}

.pdf-card:hover .pdf-thumbnail-canvas {
    transform: scale(1.03);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.pdf-render-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.pdf-fallback-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 32px;
    color: #dc3545;
    opacity: 0.8;
}

.pdf-fallback-icon span {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.pdf-thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    cursor: pointer;
    z-index: 2;
}

.pdf-card-info h4 {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-main);
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pdf-card-info p {
    font-size: 11px;
    color: var(--text-muted);
}

.pdf-card-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.btn-card {
    flex-grow: 1;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn-card.primary {
    background-color: var(--primary);
    color: #fff;
    border: 1px solid var(--primary);
}

.btn-card.primary:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
    box-shadow: 0 4px 10px var(--primary-glow);
}

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

.btn-card.secondary:hover {
    background-color: var(--border);
}

.btn-delete-card {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition);
    opacity: 0;
}

.pdf-card:hover .btn-delete-card {
    opacity: 1;
}

.btn-delete-card:hover {
    background-color: #dc3545;
    color: #fff;
    transform: scale(1.1);
}

/* ==========================================================================
   9. แท็บภาพหลักฐาน/กิจกรรม (Image Gallery Style)
   ========================================================================== */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}

.gallery-card {
    background-color: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.gallery-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.gallery-image-wrapper {
    width: 100%;
    height: 180px;
    overflow: hidden;
    position: relative;
    background-color: #2b233a;
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.gallery-card:hover .gallery-image {
    transform: scale(1.08);
}

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(92, 45, 145, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    cursor: pointer;
}

.gallery-card:hover .gallery-overlay {
    opacity: 1;
}

.gallery-overlay i {
    color: #fff;
    font-size: 26px;
    background-color: var(--primary);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.gallery-info {
    padding: 16px 20px;
}

.gallery-info h4 {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gallery-info p {
    font-size: 10.5px;
    color: var(--text-muted);
    margin-top: 6px;
}

.gallery-card:hover .btn-delete-card {
    opacity: 1;
}

/* ==========================================================================
   10. ศูนย์กลางการอัปโหลดไฟล์แอดมิน (Uploader & Form Elements)
   ========================================================================== */

.uploader-container {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 40px;
    background: linear-gradient(135deg, rgba(92, 45, 145, 0.02), rgba(255, 200, 44, 0.02));
    padding: 32px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.dropzone {
    border: 2px dashed var(--primary);
    border-radius: var(--radius-md);
    background-color: var(--bg-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    min-height: 280px;
}

.dropzone:hover, .dropzone.dragover {
    background-color: var(--primary-glow);
    border-color: var(--primary-light);
    transform: scale(0.99);
}

.dropzone i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 20px;
    transition: var(--transition);
}

.dropzone:hover i {
    transform: translateY(-5px);
    color: var(--primary-light);
}

.dropzone h5 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.dropzone p {
    font-size: 12px;
    color: var(--text-muted);
}

.selected-file-info {
    margin-top: 16px;
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
    display: none;
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}

.form-control {
    height: 46px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background-color: var(--bg-surface);
    color: var(--text-main);
    font-family: inherit;
    font-size: 13px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

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

.radio-group {
    display: flex;
    gap: 24px;
    margin-top: 4px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-main);
}

.radio-label input {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

.btn-submit {
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(92, 45, 145, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(92, 45, 145, 0.3);
}

.btn-submit:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ==========================================================================
   11. หน้าล็อกอินและระบบ Admin Login (`login.html`)
   ========================================================================== */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 10% 20%, rgba(92, 45, 145, 0.1) 0%, rgba(255, 200, 44, 0.05) 90%), var(--bg-main);
}

.login-card {
    width: 100%;
    max-width: 440px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 48px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    gap: 32px;
    text-align: center;
}

.login-card-header h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.login-card-header p {
    font-size: 13px;
    color: var(--text-muted);
}

.btn-back-home {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    margin-top: 8px;
    transition: var(--transition);
}

.btn-back-home:hover {
    color: var(--primary-light);
    transform: translateX(-4px);
}

/* ==========================================================================
   12. หน้าจอป็อปอัพชมเอกสารและรูปภาพ (Modals / Lightbox / PDF Viewer)
   ========================================================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(12, 7, 21, 0.6);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 1100px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s ease-in-out;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 15.5px;
    font-weight: 700;
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: #dc3545;
    transform: rotate(90deg);
}

.modal-body {
    flex-grow: 1;
    padding: 0;
    background-color: #3b3547;
    position: relative;
}

.pdf-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.lightbox-content {
    background: none;
    border: none;
    box-shadow: none;
    max-width: 80vw;
    height: auto;
    max-height: 80vh;
    overflow: visible;
}

.lightbox-image {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 3px solid var(--accent);
}

.lightbox-caption {
    color: #fff;
    text-align: center;
    font-size: 13.5px;
    font-weight: 500;
    margin-top: 16px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    background-color: rgba(34, 18, 54, 0.85);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    display: inline-block;
    max-width: 100%;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: #fff;
    font-size: 28px;
    background: none;
    border: none;
    cursor: pointer;
}

/* ==========================================================================
   13. ข้อความแจ้งเตือนป๊อปอัพ (Toast Notification & Alerts)
   ========================================================================== */

.toast-container {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background-color: var(--bg-surface);
    color: var(--text-main);
    border-left: 5px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 16px 28px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 300px;
    animation: slideIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    transition: var(--transition);
}

@keyframes slideIn {
    from { transform: translateX(120%); }
    to { transform: translateX(0); }
}

.toast.success {
    border-left-color: #28a745;
}

.toast.error {
    border-left-color: #dc3545;
}

.toast i {
    font-size: 16px;
}

.toast.success i {
    color: #28a745;
}

.toast.error i {
    color: #dc3545;
}

.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
    grid-column: 1 / -1;
}

.empty-state i {
    font-size: 36px;
    margin-bottom: 12px;
    color: var(--border);
}

/* ==========================================================================
   14. การตอบสนองตามความกว้างของหน้าจอ (Responsive Web Design)
   ========================================================================== */

@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        padding: 20px;
        max-height: none;
    }
    
    .sidebar-header {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }
    
    .sidebar-menu {
        flex-direction: row;
        overflow-x: auto;
        gap: 10px;
        padding-bottom: 10px;
        align-items: center;
    }
    
    .menu-title {
        display: none;
    }
    
    .menu-item {
        padding: 10px 14px;
        white-space: nowrap;
    }
    
    .accordion-wrapper {
        display: inline-block;
        vertical-align: top;
        border-radius: var(--radius-sm);
        margin-bottom: 0;
    }
    
    .accordion-header {
        padding: 10px 14px;
        border-radius: var(--radius-sm);
    }
    
    .accordion-content {
        position: absolute;
        left: 0;
        top: 100%;
        min-width: 240px;
        box-shadow: var(--shadow-lg);
        border-radius: var(--radius-sm);
        z-index: 500;
        background-color: var(--bg-sidebar);
        display: none;
    }
    
    .accordion-wrapper.expanded .accordion-content {
        display: flex;
        max-height: 300px;
        overflow-y: auto;
    }
    
    .main-content {
        height: auto;
        overflow-y: visible;
        padding: 20px;
    }
    
    .stats-overview-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .uploader-container {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

@media (max-width: 768px) {
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .header-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .search-wrapper {
        width: 100%;
    }
    
    .indicator-board {
        padding: 20px;
    }
    
    .pdf-grid {
        grid-template-columns: 1fr;
    }
    
    .quicklinks-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   สไตล์สำหรับการแสดงผลหัวข้อย่อยและกลุ่มไฟล์หลักฐาน (Sub-indicator Styling)
   ========================================================================== */
.sub-indicator-section {
    margin-bottom: 35px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
    position: relative;
    width: 100%;
}

.sub-indicator-title-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 2px solid rgba(0, 64, 133, 0.15);
    padding-bottom: 12px;
    margin-bottom: 20px;
    position: relative;
    width: 100%;
}

.sub-indicator-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--sub-indicator-color);
    margin: 0 auto;
    text-align: center;
    max-width: 85%;
    line-height: 1.6;
    display: block;
    word-break: keep-all;
    overflow-wrap: break-word;
}

.sub-indicator-title i {
    margin-right: 8px;
    color: var(--sub-indicator-color);
}

.sub-indicator-actions {
    display: flex;
    gap: 8px;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.btn-sub-action {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition);
}

[data-theme="dark"] .btn-sub-action {
    background: rgba(24, 18, 38, 0.5);
}

.btn-sub-action.edit:hover {
    color: #221236;
    background-color: var(--accent);
    border-color: var(--accent);
}

.btn-sub-action.delete:hover {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}
