/* ═══════════════════════════════════════════════════════════════
   ชมรมห้องสมุดสีเขียว (Green Libraries Group) — Custom layout
   โทนสีเขียวธรรมชาติ ทันสมัย สบายตา
   ═══════════════════════════════════════════════════════════════ */

/* ── RESET & BASE ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: 'Sarabun', 'Noto Sans Thai', 'Leelawadee UI', sans-serif;
    color: #14301F;
    background:
        radial-gradient(1200px 600px at 100% -10%, #E8F5E9 0%, rgba(232,245,233,0) 60%),
        radial-gradient(900px 500px at -10% 20%, #EAF6E8 0%, rgba(234,246,232,0) 55%),
        #F6FBF4;
    min-height: 100vh;
}

a { color: inherit; }

.glg-container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ═══════════════════════════════════════════════════════
   APP BAR
═══════════════════════════════════════════════════════ */
.glg-appbar.k-appbar {
    background: #FFFFFF;
    border: none;
    border-bottom: 1px solid #DCE8D8;
    padding: 10px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.glg-appbar-inner {
    max-width: 1080px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
}
.glg-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.glg-brand img {
    height: 44px;
    width: auto;
    display: block;
}
.glg-brand-text { line-height: 1.25; }
.glg-brand-title {
    font-size: 16px;
    font-weight: 700;
    color: #1E5631;
}
.glg-brand-sub {
    font-size: 12px;
    color: #5B6B5E;
}
.glg-nav {
    display: flex;
    gap: 4px;
    margin-left: auto;
    flex-wrap: wrap;
}
.glg-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 500;
    color: #2B3D2F;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.glg-nav a:hover { background: #EEF5EC; }
.glg-nav a.active {
    background: #2E7D4F;
    color: #fff;
}
.glg-nav a .k-icon, .glg-nav a .k-svg-icon { width: 16px; height: 16px; }

/* ═══════════════════════════════════════════════════════
   HERO
═══════════════════════════════════════════════════════ */
.glg-hero {
    max-width: 1080px;
    margin: 0 auto;
    padding: 32px 20px 8px;
    text-align: center;
}
.glg-hero h1 {
    font-size: 28px;
    font-weight: 700;
    color: #14301F;
    margin: 0 0 8px;
}
.glg-hero p {
    font-size: 15px;
    color: #4A5A4D;
    max-width: 620px;
    margin: 0 auto;
    line-height: 1.7;
}
.glg-hero-badges {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}
.glg-hero-badges .k-badge {
    font-size: 12px;
    padding: 6px 12px;
}

/* ═══════════════════════════════════════════════════════
   PAGE / CARD SHELL
═══════════════════════════════════════════════════════ */
.glg-page {
    max-width: 1080px;
    margin: 0 auto;
    padding: 20px 20px 60px;
}
.glg-page.glg-page-wide { max-width: 1280px; }

.glg-card {
    background: #FFFFFF;
    border: 1px solid #E3EEE1;
    border-radius: 20px;
    box-shadow: 0 2px 16px rgba(20, 48, 31, 0.06);
    padding: 28px;
    margin-bottom: 20px;
}
@media (max-width: 640px) {
    .glg-card { padding: 18px; border-radius: 16px; }
}

.glg-section-title {
    font-size: 17px;
    font-weight: 700;
    color: #1E5631;
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.glg-section-title .k-icon, .glg-section-title .k-svg-icon { color: #2E7D4F; }

/* ═══════════════════════════════════════════════════════
   STEPPER
═══════════════════════════════════════════════════════ */
#glg-stepper {
    margin-bottom: 28px;
}
.k-stepper .k-step-label { font-size: 13px; }
@media (max-width: 700px) {
    .k-stepper .k-step-text { display: none; }
}

/* ═══════════════════════════════════════════════════════
   STEP PANELS (wizard show/hide)
═══════════════════════════════════════════════════════ */
.glg-step-panel { display: none; }
.glg-step-panel.active {
    display: block;
    animation: glgFadeIn .25s ease;
}
@keyframes glgFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.glg-step-title {
    font-size: 19px;
    font-weight: 700;
    color: #14301F;
    margin: 0 0 4px;
}
.glg-step-desc {
    font-size: 13.5px;
    color: #5B6B5E;
    margin: 0 0 20px;
}
fieldset.glg-fieldset { border: none; margin: 0; padding: 0; }
.glg-subsection-title {
    font-size: 14px;
    font-weight: 700;
    color: #1E5631;
    margin: 22px 0 14px;
    padding-top: 18px;
    border-top: 1px dashed #E3EEE1;
}
.glg-subsection-title:first-child { border-top: none; padding-top: 0; margin-top: 0; }

/* ═══════════════════════════════════════════════════════
   FORM GRID
═══════════════════════════════════════════════════════ */
.glg-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px 20px;
}
.glg-form-grid.glg-form-grid-1 { grid-template-columns: 1fr; }
@media (max-width: 640px) {
    .glg-form-grid { grid-template-columns: 1fr; }
}
.glg-field { display: flex; flex-direction: column; gap: 6px; }
.glg-field.span-2 { grid-column: span 2; }
@media (max-width: 640px) {
    .glg-field.span-2 { grid-column: span 1; }
}
.glg-field label {
    font-size: 14px;
    font-weight: 500;
    color: #2B3D2F;
}
.glg-field label .req { color: #C4483A; margin-left: 2px; }
.glg-field .glg-hint {
    font-size: 12px;
    color: #7C8A7E;
}
.glg-field .k-input,
.glg-field .k-picker,
.glg-field .k-textarea,
.glg-field .k-dropdownlist,
.glg-field .k-combobox {
    width: 100%;
}
.glg-field .k-radio-list,
.glg-field .k-checkbox-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
}

/* ═══════════════════════════════════════════════════════
   TYPE SELECT CARDS (Step 1)
═══════════════════════════════════════════════════════ */
.glg-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
@media (max-width: 640px) {
    .glg-choice-grid { grid-template-columns: 1fr; }
}
.glg-choice-card {
    position: relative;
    border: 2px solid #E3EEE1;
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    background: #FAFDF9;
    transition: border-color .15s, background .15s, transform .1s;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.glg-choice-card:hover { border-color: #A9D5B4; transform: translateY(-1px); }
.glg-choice-card.selected,
.glg-choice-input:checked + .glg-choice-card {
    border-color: #2E7D4F;
    background: #EEF8F0;
    box-shadow: 0 0 0 3px rgba(46,125,79,0.12);
}
.glg-choice-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.glg-choice-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #E3F3E6;
    color: #2E7D4F;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.glg-choice-icon .k-icon, .glg-choice-icon .k-svg-icon { width: 22px; height: 22px; }
.glg-choice-title { font-size: 16px; font-weight: 700; color: #14301F; }
.glg-choice-desc { font-size: 13px; color: #5B6B5E; line-height: 1.5; }
.glg-choice-check {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #2E7D4F;
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
}
.glg-choice-card.selected .glg-choice-check,
.glg-choice-input:checked + .glg-choice-card .glg-choice-check { display: flex; }
.glg-choice-check .k-icon, .glg-choice-check svg { width: 14px; height: 14px; }

.glg-subchoice-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.glg-pill-option {
    border: 1.5px solid #DCE8D8;
    border-radius: 9999px;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #2B3D2F;
    background: #fff;
    cursor: pointer;
    transition: all .15s;
    user-select: none;
}
.glg-pill-option:hover { border-color: #A9D5B4; }
.glg-pill-option.selected,
.glg-pill-input:checked + .glg-pill-option {
    background: #2E7D4F;
    border-color: #2E7D4F;
    color: #fff;
}
.glg-pill-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════
   PAYMENT (Step 3)
═══════════════════════════════════════════════════════ */
.glg-pay-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #1E5631 0%, #2E7D4F 100%);
    color: #fff;
    border-radius: 16px;
    padding: 20px 24px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.glg-pay-summary-label { font-size: 13px; opacity: .85; }
.glg-pay-summary-plan { font-size: 16px; font-weight: 600; margin-top: 2px; }
.glg-pay-summary-amount { font-size: 30px; font-weight: 700; text-align: right; }
.glg-pay-summary-amount small { font-size: 13px; font-weight: 400; opacity: .85; display: block; }

.glg-pay-methods {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
@media (max-width: 700px) {
    .glg-pay-methods { grid-template-columns: 1fr; }
}
.glg-pay-box {
    border: 1px solid #E3EEE1;
    border-radius: 14px;
    padding: 18px;
    background: #FAFDF9;
    text-align: center;
}
.glg-pay-box h4 {
    margin: 0 0 10px;
    font-size: 14px;
    color: #1E5631;
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
}
.glg-qr-box {
    width: 168px;
    height: 168px;
    margin: 0 auto 10px;
    border-radius: 12px;
    background: #fff;
    border: 1px dashed #C7DDC0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}
.glg-qr-box svg { width: 100%; height: 100%; }
.glg-pay-note { font-size: 12px; color: #7C8A7E; margin-top: 6px; }
.glg-bank-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed #E3EEE1;
    font-size: 14px;
    text-align: left;
}
.glg-bank-row:last-child { border-bottom: none; }
.glg-bank-row span:first-child { color: #7C8A7E; }
.glg-bank-row span:last-child { font-weight: 600; color: #14301F; }
.glg-copy-btn { cursor: pointer; color: #2E7D4F; }
.glg-copy-btn:hover { text-decoration: underline; }

.glg-upload-wrap { margin-top: 20px; }
.glg-upload-wrap .k-upload { border-radius: 14px; overflow: hidden; }
.glg-slip-preview {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border: 1px solid #E3EEE1;
    border-radius: 12px;
    background: #FAFDF9;
}
.glg-slip-preview img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #DCE8D8;
}
.glg-slip-preview-name { font-size: 14px; font-weight: 600; color: #14301F; }
.glg-slip-preview-meta { font-size: 12px; color: #7C8A7E; }

/* ═══════════════════════════════════════════════════════
   REVIEW (Step 4)
═══════════════════════════════════════════════════════ */
.glg-review-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 24px;
}
@media (max-width: 640px) {
    .glg-review-grid { grid-template-columns: 1fr; }
}
.glg-review-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #F0F5EF;
    font-size: 14px;
}
.glg-review-item span:first-child { color: #7C8A7E; flex-shrink: 0; }
.glg-review-item span:last-child { color: #14301F; font-weight: 600; text-align: right; }
.glg-agree-row {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #E3EEE1;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.glg-agree-row label { font-size: 14px; color: #2B3D2F; line-height: 1.6; }

/* ═══════════════════════════════════════════════════════
   DONE (Step 5)
═══════════════════════════════════════════════════════ */
.glg-done {
    text-align: center;
    padding: 20px 0 8px;
}
.glg-done-icon {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: #E7F6ED;
    color: #2F8F5B;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
}
.glg-done-icon .k-icon, .glg-done-icon svg { width: 44px; height: 44px; }
.glg-done h2 { font-size: 22px; margin: 0 0 8px; color: #14301F; }
.glg-done p { color: #5B6B5E; margin: 0 0 20px; }
.glg-appno-box {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    background: #F4FAF3;
    border: 1.5px dashed #A9D5B4;
    border-radius: 14px;
    padding: 14px 28px;
    margin-bottom: 22px;
}
.glg-appno-label { font-size: 12px; color: #5B6B5E; }
.glg-appno-value { font-size: 22px; font-weight: 700; color: #1E5631; letter-spacing: 1px; }
.glg-done-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════
   WIZARD NAV BUTTONS
═══════════════════════════════════════════════════════ */
.glg-wizard-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #EEF5EC;
}
.glg-wizard-actions .k-button { min-width: 110px; }
.glg-draft-note {
    font-size: 12px;
    color: #7C8A7E;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ═══════════════════════════════════════════════════════
   STATUS BADGES (shared: status page + admin grid)
═══════════════════════════════════════════════════════ */
.glg-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
}
.glg-status-pending { background: #FDF1E2; color: #A15F12; }
.glg-status-approved { background: #E7F6ED; color: #1E5631; }
.glg-status-rejected { background: #FBEAE8; color: #7A2E24; }
.glg-status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ═══════════════════════════════════════════════════════
   STATUS TRACKING PAGE
═══════════════════════════════════════════════════════ */
.glg-track-search {
    display: flex;
    gap: 10px;
    max-width: 520px;
    margin: 0 auto 8px;
}
.glg-track-search .k-input { flex: 1; }
.glg-track-result { margin-top: 24px; }
.glg-track-timeline {
    margin: 24px 0;
}
.glg-tl {
    display: flex;
    justify-content: space-between;
    position: relative;
    padding: 0 4px;
}
.glg-tl::before {
    content: "";
    position: absolute;
    top: 18px;
    left: 12%;
    right: 12%;
    height: 2px;
    background: #E3EEE1;
    z-index: 0;
}
.glg-tl-step {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
}
.glg-tl-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    background: #EEF5EC;
    color: #A9BBA9;
    border: 1.5px solid #DCE8D8;
}
.glg-tl-label { font-size: 12.5px; color: #5B6B5E; text-align: center; max-width: 110px; }
.glg-tl-step.is-done .glg-tl-dot { background: #2F8F5B; border-color: #2F8F5B; color: #fff; }
.glg-tl-step.is-done .glg-tl-label { color: #1E5631; font-weight: 600; }
.glg-tl-step.is-current .glg-tl-dot { background: #D98324; border-color: #D98324; color: #fff; box-shadow: 0 0 0 4px rgba(217,131,36,0.16); }
.glg-tl-step.is-current .glg-tl-label { color: #A15F12; font-weight: 700; }
.glg-tl-step.is-error .glg-tl-dot { background: #C4483A; border-color: #C4483A; color: #fff; }
.glg-tl-step.is-error .glg-tl-label { color: #7A2E24; font-weight: 700; }
.glg-track-receipt {
    background: #F4FAF3;
    border: 1px dashed #A9D5B4;
    border-radius: 14px;
    padding: 18px;
    margin-top: 16px;
}

/* ═══════════════════════════════════════════════════════
   ADMIN DASHBOARD
═══════════════════════════════════════════════════════ */
.glg-admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
@media (max-width: 800px) {
    .glg-admin-stats { grid-template-columns: repeat(2, 1fr); }
}
.glg-stat-card {
    background: #fff;
    border: 1px solid #E3EEE1;
    border-radius: 16px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.glg-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.glg-stat-icon .k-icon, .glg-stat-icon .k-svg-icon { width: 20px; height: 20px; }
.glg-stat-value { font-size: 22px; font-weight: 700; color: #14301F; line-height: 1.2; }
.glg-stat-label { font-size: 12px; color: #7C8A7E; }

#glg-admin-grid .k-grid { border-radius: 16px; overflow: hidden; border-color: #E3EEE1; }
#glg-admin-grid .k-grid-content tr:hover td { background: #F4FAF3 !important; }

.glg-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 20px;
    font-size: 14px;
    margin-bottom: 16px;
}
@media (max-width: 560px) { .glg-detail-grid { grid-template-columns: 1fr; } }
.glg-detail-grid div span:first-child { color: #7C8A7E; display: block; font-size: 12px; }
.glg-detail-grid div span:last-child { color: #14301F; font-weight: 600; }
.glg-slip-view img {
    max-width: 100%;
    border-radius: 10px;
    border: 1px solid #E3EEE1;
    cursor: zoom-in;
}
.glg-reject-reason { margin-top: 12px; display: none; }
.glg-reject-reason.show { display: block; }

/* ═══════════════════════════════════════════════════════
   LOGIN (staff)
═══════════════════════════════════════════════════════ */
.glg-login-card {
    max-width: 380px;
    margin: 60px auto;
    text-align: center;
}
.glg-login-card .glg-choice-icon { margin: 0 auto 14px; }

/* ═══════════════════════════════════════════════════════
   MAP PAGE
═══════════════════════════════════════════════════════ */
.glg-map-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
    align-items: start;
}
@media (max-width: 900px) {
    .glg-map-layout { grid-template-columns: 1fr; }
}
#glg-map {
    width: 100%;
    height: 620px;
    border-radius: 20px;
    overflow: hidden;
    background: #EAF6E8;
}
.glg-map-card { padding: 0; overflow: hidden; }
.glg-map-search {
    padding: 16px 16px 10px;
}
.glg-map-legend {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px 16px;
    font-size: 12px;
    color: #5B6B5E;
    flex-wrap: wrap;
}
.glg-legend-scale {
    display: flex;
    border-radius: 6px;
    overflow: hidden;
    height: 12px;
    flex: 1;
    min-width: 120px;
}
.glg-legend-scale span { flex: 1; }
.glg-province-list {
    max-height: 300px;
    overflow-y: auto;
    border-top: 1px solid #EEF5EC;
}
.glg-province-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid #F5FAF3;
}
.glg-province-row:hover { background: #F4FAF3; }
.glg-province-row.active { background: #EEF8F0; }
.glg-province-row .cnt {
    font-size: 11px;
    font-weight: 700;
    color: #1E5631;
    background: #E3F3E6;
    padding: 2px 8px;
    border-radius: 9999px;
}
.glg-lib-panel { padding: 16px; }
.glg-lib-panel-title { font-size: 15px; font-weight: 700; color: #14301F; margin-bottom: 2px; }
.glg-lib-panel-sub { font-size: 12px; color: #7C8A7E; margin-bottom: 14px; }
.glg-lib-card {
    border: 1px solid #E3EEE1;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
}
.glg-lib-card:last-child { margin-bottom: 0; }
.glg-lib-name { font-size: 13.5px; font-weight: 700; color: #14301F; margin-bottom: 3px; }
.glg-lib-type { font-size: 11px; color: #2E7D4F; font-weight: 600; margin-bottom: 4px; }
.glg-lib-addr { font-size: 12px; color: #5B6B5E; line-height: 1.5; }
.glg-lib-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #1E5631;
    background: #E7F6ED;
    padding: 2px 8px;
    border-radius: 9999px;
}
.glg-map-empty { text-align: center; color: #7C8A7E; font-size: 13px; padding: 30px 10px; }
.glg-map-demo-note {
    font-size: 11.5px;
    color: #A15F12;
    background: #FDF1E2;
    border-radius: 10px;
    padding: 8px 12px;
    margin: 0 16px 14px;
}

/* ═══════════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════════ */
.glg-footer {
    text-align: center;
    padding: 30px 20px 40px;
    color: #7C8A7E;
    font-size: 12.5px;
}
.glg-footer a { color: #2E7D4F; text-decoration: none; }
.glg-footer a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════
   PRINT (receipt)
═══════════════════════════════════════════════════════ */
@media print {
    .glg-appbar, .glg-footer, .glg-no-print { display: none !important; }
    body { background: #fff !important; }
    .glg-card { box-shadow: none !important; border: 1px solid #ccc !important; }
}
