/* Project layer on top of Bootstrap 5.3 + Logis (static/logis/css/main.css). Logis colour system is kept;
   fonts are Thai (Prompt for headings / menu, Sarabun for text). */

:root {
  --default-font: "Sarabun", "Leelawadee UI", "Noto Sans Thai", "Tahoma", system-ui, sans-serif;
  --heading-font: "Prompt", "Sarabun", "Leelawadee UI", sans-serif;
  --nav-font: "Prompt", "Sarabun", "Leelawadee UI", sans-serif;
  --header-h: 72px;
  /* Bootstrap follows the Logis accent */
  --bs-primary: #0d42ff;
  --bs-primary-rgb: 13, 66, 255;
  --bs-link-color: #0d42ff;
  --bs-link-color-rgb: 13, 66, 255;
  --bs-body-font-family: var(--default-font);
  --bs-body-font-size: 1rem;
  --bs-body-line-height: 1.65;
}

body { font-family: var(--default-font); background: #f7f9fc; }
.btn-primary {
  --bs-btn-bg: var(--accent-color); --bs-btn-border-color: var(--accent-color);
  --bs-btn-hover-bg: #0a35cc; --bs-btn-hover-border-color: #0a35cc;
  --bs-btn-active-bg: #0a35cc; --bs-btn-active-border-color: #0a35cc;
  --bs-btn-disabled-bg: var(--accent-color); --bs-btn-disabled-border-color: var(--accent-color);
  font-family: var(--heading-font); font-weight: 500;
}
.btn-outline-primary {
  --bs-btn-color: var(--accent-color); --bs-btn-border-color: var(--accent-color);
  --bs-btn-hover-bg: var(--accent-color); --bs-btn-hover-border-color: var(--accent-color);
  --bs-btn-active-bg: var(--accent-color); --bs-btn-active-border-color: var(--accent-color);
  font-family: var(--heading-font);
}
.text-primary { color: var(--accent-color) !important; }
.form-check-input:checked { background-color: var(--accent-color); border-color: var(--accent-color); }
.form-control:focus, .form-select:focus { border-color: #86a0ff; box-shadow: 0 0 0 .2rem rgba(13, 66, 255, .15); }
.progress-bar { background-color: var(--accent-color); }

/* ---------------------------------------------------------------- header (always dark, sticky) */
.header { --background-color: #0e1d34; padding: 12px 0; }
.header .logo { gap: .6rem; }
.header .logo-mark { font-size: 1.9rem; color: #5ea8ff; line-height: 1; }
.header .sitename { display: block; font-family: var(--heading-font); font-size: 1.12rem; font-weight: 600; color: #fff; line-height: 1.25; }
.header .site-owner { display: block; font-size: .8rem; color: rgba(255, 255, 255, .65); line-height: 1.3; }
@media (min-width: 1200px) {
  .navmenu a, .navmenu a:focus { font-size: 15.5px; padding: 18px 13px; }
  .navmenu .dropdown ul a { font-size: 15px; }
}

/* ---------------------------------------------------------------- page band (Logis page-title, shorter) */
.page-title { padding: 46px 0 36px; background-image: url("../logis/img/world-dotted-map.png"); background-size: cover; }
.page-title h1 { font-size: 2rem; font-family: var(--heading-font); }
.page-title .page-lead-band { max-width: 760px; margin: 0 auto 12px; color: rgba(255, 255, 255, .8); }
.page-title .page-lead-band:empty { display: none; }

/* ---------------------------------------------------------------- home: hero + choices */
.hero { padding: 70px 0 60px; min-height: 0; }
.hero .owner-label { display: inline-block; font-family: var(--heading-font); font-weight: 500; font-size: .95rem;
  color: #fff; background: rgba(255, 255, 255, .12); border-radius: 30px; padding: 4px 16px; margin-bottom: 18px; }
.hero h2 { font-size: 2.1rem; line-height: 1.4; font-family: var(--heading-font); }
.hero .work { color: rgba(255, 255, 255, .8); margin-bottom: 22px; }
.hero .objective { border-left: 3px solid var(--accent-color); padding-left: 14px; margin-bottom: 28px; }
.hero .objective strong { display: block; font-family: var(--heading-font); color: #fff; margin-bottom: 4px; }
.hero .stats-item { background: rgba(255, 255, 255, .06); border-radius: 8px; padding: 20px 10px; }
.hero .stats-item span { font-size: 28px; }
.hero .stats-item p { font-size: 14px; color: rgba(255, 255, 255, .85); }
.status-panel { background: var(--surface-color); border-radius: 10px; padding: 22px; }
.status-panel h3 { font-size: 1.05rem; color: #fff; margin-bottom: 14px; }
.status-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, .12); }
.status-row .prov { font-family: var(--heading-font); font-weight: 500; color: #fff; }
.status-row .meta { font-size: .85rem; color: rgba(255, 255, 255, .7); }
.featured-services .service-item { background: #fff; border-radius: 10px; padding: 28px 24px; box-shadow: 0 2px 14px rgba(14, 29, 52, .07); }
.featured-services .service-item .title { font-family: var(--heading-font); font-size: 1.2rem; }
.featured-services .readmore { font-family: var(--heading-font); font-weight: 500; }
.section-title h2 { text-transform: none; font-family: var(--heading-font); }
.section-title span { text-transform: none; }

/* ---------------------------------------------------------------- inner pages */
.card { border-color: #e3e8f0; border-radius: 10px; }
.card-header { background: #fff; font-family: var(--heading-font); font-weight: 500; border-radius: 10px 10px 0 0 !important; }
.stat-value { font-size: 1.6rem; font-weight: 600; font-family: var(--heading-font); font-variant-numeric: tabular-nums; line-height: 1.2; color: var(--heading-color); }
.stat-label { color: #5b6770; font-size: .88rem; }
.step-badge { display: inline-flex; align-items: center; justify-content: center; width: 1.7rem; height: 1.7rem;
  border-radius: 50%; background: var(--accent-color); color: #fff; font-weight: 600; font-size: .9rem; margin-right: .45rem; }
.num { font-variant-numeric: tabular-nums; }
.table { --bs-table-hover-bg: #f2f5fb; }
.table thead th { background: #f4f6fa; font-weight: 600; white-space: nowrap; font-family: var(--heading-font); font-size: .92rem; }
.sm-chip { display: inline-block; min-width: 3.6rem; text-align: center; padding: .15rem .5rem; border-radius: 6px; white-space: nowrap;
  font-weight: 600; font-variant-numeric: tabular-nums; border: 1px solid rgba(0, 0, 0, .08); }

/* ---------------------------------------------------------------- loader */
.blocker { position: fixed; inset: 0; background: rgba(255, 255, 255, .85); display: none; align-items: center; justify-content: center; z-index: 5000; }
.blocker.on { display: flex; }
.progress.indeterminate .progress-bar { width: 30% !important; animation: slide 1.4s infinite linear; }
@keyframes slide { from { margin-left: -30%; } to { margin-left: 100%; } }

/* ---------------------------------------------------------------- map pages */
.map-layout { display: grid; grid-template-columns: 360px 1fr; height: calc(100vh - var(--header-h)); min-height: 520px; }
.map-side { background: #fff; border-right: 1px solid #e3e8f0; overflow-y: auto; padding: 1rem; }
.map-main { position: relative; }
#map { position: absolute; inset: 0; }
.map-box { height: 460px; border: 1px solid #e3e8f0; border-radius: 10px; position: relative; overflow: hidden; }
.map-box > #map, .map-box > #map-picker { position: absolute; inset: 0; }
.date-big { font-size: 1.25rem; font-weight: 600; font-family: var(--heading-font); color: var(--heading-color); }
.legend .ramp { height: 14px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .15); margin: .3rem 0 .1rem; }
.legend .ticks { display: flex; justify-content: space-between; color: #6c757d; font-size: .8rem; }
.legend .words { display: flex; justify-content: space-between; font-size: .8rem; margin-top: .1rem; }
.legend .sw { display: inline-block; width: 13px; height: 13px; border: 1px solid rgba(0, 0, 0, .2); vertical-align: -2px; margin-right: .3rem; border-radius: 2px; }
.timeline { height: 80px; }
.leaflet-container { font-family: var(--default-font); }

@media (max-width: 860px) {
  .map-layout { grid-template-columns: 1fr; height: auto; }
  .map-side { border-right: 0; border-bottom: 1px solid #e3e8f0; }
  .map-main { height: 70vh; }
}

/* ---------------------------------------------------------------- small screens */
.header .logo { min-width: 0; flex: 1 1 auto; }
.header .logo > span { min-width: 0; }
.header .sitename { overflow-wrap: anywhere; }
@media (max-width: 1199px) {
  .header .mobile-nav-toggle { color: #fff; font-size: 28px; margin-left: 12px; }
  .header .sitename { font-size: .98rem; }
}
@media (max-width: 575px) {
  .header .site-owner { display: none; }
  .hero h2 { font-size: 1.5rem; }
  .hero .objective { font-size: .95rem; }
  .hero .stats-item span { font-size: 22px; }
  .page-title h1 { font-size: 1.5rem; }
}


/* ---------------------------------------------------------------- home: "why AI" flow */
.why-ai { padding-bottom: 50px; }
.flow { display: flex; align-items: stretch; gap: 6px; }
.flow-step { flex: 1 1 0; background: var(--surface-color); border: 1px solid #e3e8f0; border-radius: 10px;
  padding: 18px 14px; text-align: center; position: relative; }
.flow-step h4 { font-family: var(--heading-font); font-size: 1rem; font-weight: 600; margin: 8px 0 6px; color: var(--heading-color); }
.flow-step p { font-size: .9rem; color: #4d5866; margin: 0; }
.flow-icon { width: 54px; height: 54px; margin: 0 auto; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent-color), transparent 90%); color: var(--accent-color); font-size: 26px; }
.flow-num { position: absolute; top: 10px; left: 12px; font-family: var(--heading-font); font-weight: 600; font-size: .85rem; color: #9aa5b4; }
.flow-result { background: var(--accent-color); border-color: var(--accent-color); }
.flow-result h4, .flow-result p, .flow-result .flow-num { color: #fff; }
.flow-result .flow-icon { background: rgba(255, 255, 255, .18); color: #fff; }
.flow-arrow { display: flex; align-items: center; color: var(--accent-color); font-size: 20px; }
@media (max-width: 1199px) {
  .flow { flex-direction: column; max-width: 560px; margin: 0 auto; }
  .flow-arrow { justify-content: center; }
  .flow-arrow i { transform: rotate(90deg); }
}

/* ---------------------------------------------------------------- main map page: result of the chosen area */
.result-card { border-left: 4px solid var(--accent-color); }
.res-value { font-size: 1.1rem; }
.sm-chip-lg { font-size: 1.6rem; padding: .2rem .8rem; border-radius: 8px; }
.area-chart { height: 130px; }

/* ---------------------------------------------------------------- side panels: one card per section */
.map-side { background: #f2f5fa; }
.side-intro { margin-bottom: .9rem; }
.side-card { margin-bottom: .8rem; }
.side-card > .card-header { font-size: .95rem; padding: .55rem .9rem; display: flex; align-items: center;
  border-bottom-color: #e3e8f0; }
.side-card > .card-header .step-badge { width: 1.5rem; height: 1.5rem; font-size: .82rem; }
.side-card > .card-body { padding: .75rem .9rem; }
.side-card.legend .ramp { margin-top: 0; }
.side-card .form-check:last-child { margin-bottom: 0; }
.info-btn { margin-left: auto; border: 0; background: none; padding: 0 .1rem; color: var(--accent-color); font-size: 1.05rem;
  line-height: 1; cursor: pointer; }
.info-btn:hover, .info-btn:focus-visible { color: #0a35cc; }
.help-modal .modal-title { font-family: var(--heading-font); }
.help-modal h3 { font-family: var(--heading-font); font-weight: 600; margin-top: .4rem; }
.help-modal li { margin-bottom: .35rem; }

/* ---------------------------------------------------------------- Thai month calendar (static/js/calendar.js) */
.tcal-head { display: flex; gap: .3rem; align-items: center; margin-bottom: .4rem; }
.tcal-head .tcal-month { flex: 1 1 auto; }
.tcal-head .tcal-year { flex: 0 0 5.2rem; }
.tcal-head .btn { padding: .2rem .45rem; }
.tcal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.tcal-dow { text-align: center; font-size: .75rem; color: #6c757d; padding-bottom: 2px; }
.tcal-day { position: relative; height: 2.25rem; border: 1px solid #e3e8f0; border-radius: 6px; background: #fff;
  font-size: .85rem; font-variant-numeric: tabular-nums; color: #1d2327; padding: 0; line-height: 1.1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; }
.tcal-day:not(:disabled):hover { outline: 2px solid #86a0ff; outline-offset: -1px; }
.tcal-day:disabled { background: transparent; border-color: transparent; color: #c3cad3; }
.tcal-day.is-dark { color: #fff; }
.tcal-day.is-cloud { background: #e9ecef; color: #5b6770; }
.tcal-day.is-avail { background: #e7edff; border-color: #b9c8ff; }
.tcal-day i { font-size: .62rem; line-height: 1; margin-top: 1px; }
.tcal-day.is-selected { outline: 3px solid #d61f1f !important; outline-offset: -1px; font-weight: 700; }
.tcal.is-busy .tcal-grid { opacity: .45; pointer-events: none; }
.tcal-busy { font-size: .85rem; color: #5b6770; margin-top: .4rem; }
.cal-key { display: flex; flex-wrap: wrap; gap: .25rem .8rem; font-size: .75rem; color: #5b6770; margin-top: .45rem; }
.key-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid #ccd3dc; margin-right: .3rem; vertical-align: -1px; }
.key-sw.key-value { background: linear-gradient(to right, #edf8b1, #41b6c4, #253494); border-color: transparent; }
.key-sw.key-cloud { background: #e9ecef; }
.key-sw.key-none { background: transparent; border-style: dashed; }
.key-sw.key-clear { background: #fff; }
.zone-toggle { text-decoration: none; font-family: var(--heading-font); }

/* ---------------------------------------------------------------- controls on the map (legend, layers) */
.map-legend { background: rgba(255, 255, 255, .95); border: 1px solid rgba(0, 0, 0, .2); border-radius: 8px; padding: .45rem .65rem .5rem;
  width: 230px; font-size: .8rem; line-height: 1.35; }
.map-legend-head { display: flex; align-items: center; font-family: var(--heading-font); font-weight: 600; font-size: .85rem; margin-bottom: .25rem; }
.map-legend .ramp { height: 12px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .15); }
.map-legend .ticks, .map-legend .words { display: flex; justify-content: space-between; color: #4d5866; font-size: .72rem; }
.map-legend .words { color: #1d2327; }
.map-legend-note { font-size: .72rem; color: #5b6770; margin-top: .25rem; }
.map-layers { background: #fff; border: 1px solid rgba(0, 0, 0, .2); border-radius: 8px; }
.map-layers-btn { border: 0; background: #fff; border-radius: 8px; padding: .4rem .7rem; font-family: var(--heading-font);
  font-size: .9rem; color: #1d2327; display: flex; align-items: center; gap: .4rem; }
.map-layers-btn i { color: var(--accent-color); font-size: 1.05rem; }
.map-layers-btn:hover { background: #f2f5fa; }
.map-layers-panel { padding: .55rem .75rem .6rem; width: 250px; max-height: 70vh; overflow-y: auto; }
.btn-close-sm { width: .6em; height: .6em; }
@media (max-width: 575px) {
  .map-legend { width: 190px; }
  .map-legend-note { display: none; }
}

/* ---------------------------------------------------------------- AI analysis page */
.area-option { display: block; border: 2px solid #dfe5ee; border-radius: 10px; padding: .75rem .9rem; cursor: pointer; background: #fff; height: 100%; }
.area-option:hover { border-color: #86a0ff; }
.btn-check:checked + .area-option { border-color: var(--accent-color); background: #f0f4ff; }
.btn-check:focus-visible + .area-option { box-shadow: 0 0 0 .2rem rgba(13, 66, 255, .25); }
.area-option-title { display: block; font-family: var(--heading-font); font-weight: 600; font-size: 1.05rem; color: var(--heading-color); }
.area-option-meta { display: block; font-size: .85rem; color: #5b6770; }
.ai-cal-wrap { max-width: 460px; }
.ai-cal-wrap .tcal-day { height: 2.7rem; font-size: .95rem; }
.ai-cal-wrap .tcal-day i { font-size: .8rem; }
.tcal-day.is-clear { background: #fffaf0; border-color: #f3d48a; }
.tcal-day.is-clear i { color: #e0a100; }
.tcal-day.is-part { background: #f4f6fa; border-color: #cfd6e0; }
.tcal-day.is-part i { color: #7a8794; }
.tcal-day.is-cloudy { background: #e4e8ee; border-color: #c3cad3; }
.tcal-day.is-cloudy i { color: #5b6770; }
.pick-date { font-family: var(--heading-font); font-size: 1.05rem; }
.ai-map { height: 320px; position: relative; }
.ai-map > #map-ai { position: absolute; inset: 0; border-radius: 0 0 10px 10px; }
.ai-steps li { margin-bottom: .45rem; }
