/* Green Campus Survey — custom styles (ใช้ร่วมกับ Bootstrap 5) */
:root {
    --gcs-green: #198754;
    --gcs-green-dark: #146c43;
    --gcs-green-soft: #e8f5ee;
    --bs-body-font-family: "Noto Sans Thai", "Leelawadee UI", Tahoma, system-ui, sans-serif;
}

body {
    background: linear-gradient(180deg, #f3faf6 0%, #f8f9fa 340px);
    font-family: var(--bs-body-font-family);
    min-height: 100vh;
}

.app-header {
    background: linear-gradient(135deg, #198754 0%, #0f5132 100%);
    padding-bottom: 4.5rem !important;
}
.app-header .container { padding-bottom: 3.5rem !important; }
.text-white-75 { color: rgba(255, 255, 255, .8); }

.survey-card {
    margin-top: -4.5rem;
    border-radius: 1.25rem;
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
}

/* ---------- Stepper ---------- */
.stepper { position: relative; gap: .25rem; }
.stepper::before {
    content: ""; position: absolute; top: 17px; left: 18px; right: 18px;
    height: 2px; background: #dee2e6; z-index: 0;
}
.stepper-item { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; flex: 1; text-align: center; }
.stepper-dot {
    width: 36px; height: 36px; border-radius: 50%;
    display: grid; place-items: center; font-weight: 700;
    background: #fff; border: 2px solid #dee2e6; color: #6c757d;
    transition: all .2s;
}
.stepper-label { font-size: .75rem; margin-top: .35rem; color: #6c757d; line-height: 1.2; }
.stepper-item.done .stepper-dot { background: var(--gcs-green); border-color: var(--gcs-green); color: #fff; }
.stepper-item.active .stepper-dot { border-color: var(--gcs-green); color: var(--gcs-green); box-shadow: 0 0 0 4px rgba(25, 135, 84, .18); }
.stepper-item.active .stepper-label { color: var(--gcs-green); font-weight: 600; }
.stepper-item.skipped .stepper-dot { border-style: dashed; color: #ced4da; background: #f8f9fa; text-decoration: line-through; }
.stepper-item.skipped .stepper-label { color: #ced4da; }

/* ---------- Steps ---------- */
.form-step { display: none; animation: fadeIn .25s ease; }
.form-step.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.step-heading {
    font-size: 1.25rem; font-weight: 700; color: #212529;
    padding-bottom: .75rem; margin-bottom: 1.25rem; border-bottom: 1px solid #eef0f2;
}
.form-label { font-weight: 500; }

/* ---------- ปุ่มตัวเลือก ---------- */
.btn-choice {
    --bs-btn-padding-y: .7rem;
    text-align: left; white-space: normal;
    border: 1.5px solid #ced4da; background: #fff; color: #343a40;
    border-radius: .75rem; position: relative; padding-left: 2.5rem;
    min-height: 3rem;
}
.btn-choice::before {
    content: ""; position: absolute; left: .9rem; top: 50%; transform: translateY(-50%);
    width: 1.05rem; height: 1.05rem; border: 2px solid #adb5bd; border-radius: 50%; background: #fff;
}
input[type=checkbox] + .btn-choice::before { border-radius: .3rem; }
.btn-choice:hover { border-color: var(--gcs-green); background: var(--gcs-green-soft); color: #212529; }
.btn-check:checked + .btn-choice {
    border-color: var(--gcs-green); background: var(--gcs-green-soft); color: var(--gcs-green-dark); font-weight: 600;
}
.btn-check:checked + .btn-choice::before {
    border-color: var(--gcs-green); background: var(--gcs-green);
    box-shadow: inset 0 0 0 3px #fff;
}
input[type=checkbox]:checked + .btn-choice::before {
    box-shadow: none;
    background: var(--gcs-green) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e") center/100% no-repeat;
}
.btn-check:focus-visible + .btn-choice,
.btn-check:focus-visible + .btn-scale { box-shadow: 0 0 0 .25rem rgba(25, 135, 84, .3); }
.btn-check:disabled + .btn-choice { opacity: .5; }

/* ---------- Linear Scale 1-5 ---------- */
.scale-card { background: #f8f9fa; border-radius: 1rem; padding: 1rem 1rem 1.1rem; }
.scale-group { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; max-width: 460px; }
.btn-scale {
    border: 1.5px solid #ced4da; background: #fff; border-radius: .75rem;
    font-size: 1.25rem; font-weight: 700; padding: .65rem 0; color: #495057;
}
.btn-scale:hover { border-color: var(--gcs-green); background: var(--gcs-green-soft); }
.btn-check:checked + .btn-scale {
    background: var(--gcs-green); border-color: var(--gcs-green); color: #fff;
    box-shadow: 0 6px 14px -6px rgba(25, 135, 84, .7); transform: translateY(-1px);
}
.scale-card .d-flex { max-width: 460px; }

/* ---------- Validation ---------- */
.choice-group.is-invalid .btn-choice,
.choice-group.is-invalid .btn-scale { border-color: var(--bs-danger); }
.choice-group.is-invalid ~ .invalid-feedback { display: block; }

.cond-box { background: #f6fbf8; border: 1px dashed #a3cfbb; border-radius: 1rem; padding: 1rem; }
.consent-box { background: var(--gcs-green-soft); border-radius: .75rem; padding: 1rem 1rem 1rem 1.25rem; }
.consent-box .form-check-input { width: 1.25em; height: 1.25em; margin-top: .15em; }

.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 575.98px) {
    .survey-card { border-radius: 1rem; }
    .step-nav .btn { flex: 1; padding-left: .5rem !important; padding-right: .5rem !important; }
    .stepper-dot { width: 30px; height: 30px; font-size: .85rem; }
    .stepper::before { top: 14px; }
}

/* ---------- Step 2: รายการการเดินทาง ---------- */
.trip-intro { background: #f6fbf8; border-left: 4px solid var(--gcs-green); border-radius: .5rem; padding: .85rem 1rem; }
.trip-card {
    border: 1.5px solid #dfe7e2; border-radius: 1rem; background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,.03); overflow: hidden;
    animation: fadeIn .2s ease; transition: opacity .16s, transform .16s;
}
.trip-card.removing { opacity: 0; transform: scale(.98); }
.trip-card-head {
    display: flex; align-items: center; gap: .6rem;
    background: #f3f8f5; padding: .65rem .9rem; border-bottom: 1px solid #e3ece6;
}
.trip-no {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
    display: grid; place-items: center; font-weight: 700; font-size: .85rem;
    background: var(--gcs-green); color: #fff;
}
.trip-title { font-weight: 600; line-height: 1.3; }
.trip-remove { color: #b02a37; border: 1px solid transparent; font-size: .85rem; white-space: nowrap; }
.trip-remove:hover { background: #fbe9eb; border-color: #f1c2c7; color: #842029; }
.trip-card-body { padding: 1rem; }
.trip-card .cond-box { padding: .9rem; }

.choice-icon { font-size: 1.15rem; margin-right: .45rem; vertical-align: -1px; }
.btn-choice:has(.choice-icon) { padding-left: 2.35rem; }

.days-group { display: grid; grid-template-columns: repeat(7, 1fr); gap: .4rem; max-width: 460px; }
.days-group .btn-scale { font-size: 1.05rem; padding: .5rem 0; }

.btn-add-trip {
    border: 2px dashed #9fd1b6; color: var(--gcs-green-dark); background: #fff;
    border-radius: 1rem; padding: .85rem; font-weight: 600;
}
.btn-add-trip:hover:not(:disabled) { background: var(--gcs-green-soft); border-color: var(--gcs-green); color: var(--gcs-green-dark); }
.btn-add-trip:disabled { opacity: .45; }

.trip-summary { border: 1.5px solid #dee2e6; border-radius: 1rem; padding: .8rem 1rem; background: #fff; transition: all .2s; }
.trip-summary-days { font-size: 1.9rem; font-weight: 700; line-height: 1; color: #6c757d; min-width: 64px; text-align: center; }
.trip-summary-days small { font-size: .9rem; color: #adb5bd; font-weight: 500; }
.trip-summary.ok { border-color: #a3cfbb; background: #f6fbf8; }
.trip-summary.ok .trip-summary-days { color: var(--gcs-green); }
.trip-summary.over, .trip-summary.is-invalid { border-color: var(--bs-danger); background: #fdf3f4; }
.trip-summary.over .trip-summary-days { color: var(--bs-danger); }
.trip-card .btn-choice { font-size: .95rem; line-height: 1.35; }
.mode-group.collapsed { grid-template-columns: 1fr; }
.mode-group.collapsed > .col { flex: 0 0 100%; max-width: 100%; }
.trip-change { color: var(--gcs-green-dark); text-decoration: none; font-weight: 500; }
.trip-change:hover { text-decoration: underline; }
@media (max-width: 575.98px) {
    .trip-card-body { padding: .85rem; }
    .trip-card .btn-choice { padding-left: 2.1rem; padding-right: .5rem; font-size: .9rem; }
    .trip-card .btn-choice::before { left: .7rem; }
    .trip-card .choice-icon { margin-right: .3rem; }
}

/* ---------- Step 4 ---------- */
.confirm-box { background: #f6fbf8; border: 1.5px solid #cfe6d9; border-radius: 1rem; padding: 1rem; }
.section-tag {
    display: inline-block; font-size: .78rem; font-weight: 600; letter-spacing: .02em;
    color: var(--gcs-green-dark); background: var(--gcs-green-soft); border-radius: 999px;
    padding: .2rem .75rem; margin-bottom: .9rem;
}

/* ---------- โลโก้มุมขวาบน ---------- */
.header-logos { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.header-logo {
    display: inline-flex; align-items: center; justify-content: center;
    height: 56px; min-width: 56px; padding: 6px 10px;
    background: #fff; border-radius: .85rem; box-shadow: 0 4px 14px rgba(0,0,0,.15);
}
.header-logo img { height: 100%; width: auto; max-width: 150px; object-fit: contain; display: block; }
.header-logo-text { font-size: .75rem; font-weight: 600; color: var(--gcs-green-dark); text-align: center; line-height: 1.2; max-width: 110px; }
@media (max-width: 575.98px) {
    .header-logo { height: 44px; min-width: 44px; padding: 4px 8px; border-radius: .7rem; }
    .header-logo img { max-width: 110px; }
    .header-logo-text { font-size: .68rem; max-width: 84px; }
}

/* ตัวเลือกที่ถูกโฟกัส (คีย์บอร์ด / ระบบพาไปยังข้อที่ยังไม่ตอบ) ต้องยังเห็นกรอบชัดเจน */
.btn-check:focus-visible + .btn-choice,
.btn-check:focus-visible + .btn-scale {
    border: 1.5px solid var(--gcs-green) !important;
    box-shadow: 0 0 0 .25rem rgba(25, 135, 84, .25);
}
.choice-group.is-invalid .btn-check:focus-visible + .btn-choice,
.choice-group.is-invalid .btn-check:focus-visible + .btn-scale { border-color: var(--bs-danger) !important; }
