/* css_base.css — Feasibility Microsite
   Reset, CSS variables, typography, shared utilities
   ─────────────────────────────────────────────────── */

/* ── Google Fonts: Sarabun (Thai + Latin) ── */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

/* ── CSS Custom Properties ── */
:root {
    /* Brand colours */
    --primary:          #0F6E56;
    --primary-light:    #E1F5EE;
    --primary-mid:      #5DCAA5;
    --accent:           #1D9E75;

    /* Semantic colours */
    --green:            #0F6E56;
    --green-bg:         #E1F5EE;
    --yellow:           #A07000;
    --yellow-bg:        #FFF8E1;
    --red:              #A32D2D;
    --red-bg:           #FFF0F0;
    --gray:             #6B7280;
    --gray-bg:          #F3F4F6;

    /* Neutral palette */
    --bg:               #FAFAFA;
    --surface:          #FFFFFF;
    --border:           #E5E7EB;
    --border-strong:    #D1D5DB;

    /* Text */
    --text-primary:     #111827;
    --text-secondary:   #374151;
    --text-tertiary:    #9CA3AF;

    /* Spacing */
    --space-xs:  4px;
    --space-sm:  8px;
    --space-md:  16px;
    --space-lg:  24px;
    --space-xl:  40px;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    /* Shadow */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.10);

    /* Layout */
    --max-width: 720px;
    --font:      'Sarabun', sans-serif;
}

/* ── Reset ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg);
    min-height: 100vh;
}

img, svg {
    display: block;
    max-width: 100%;
}

button {
    font-family: var(--font);
    cursor: pointer;
    border: none;
    outline: none;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: var(--border-strong);
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.20);
    transition: transform 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.20);
    cursor: pointer;
}

/* ── Layout helpers ── */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-md);
}

/* ── Loading overlay ── */
#loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 500;
    color: var(--primary);
    z-index: 999;
    backdrop-filter: blur(2px);
}

#loading-overlay::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2.5px solid var(--primary-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Error message ── */
#error-msg {
    position: fixed;
    bottom: var(--space-lg);
    left: 50%;
    transform: translateX(-50%);
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid #F5C6C6;
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-lg);
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    max-width: 90vw;
    text-align: center;
    box-shadow: var(--shadow-md);
}

/* ── Utility: hidden ── */
.hidden {
    display: none !important;
}

/* ── Utility: flex helpers ── */
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-sm      { gap: var(--space-sm); }
.gap-md      { gap: var(--space-md); }

/* ── Scrollbar (webkit) ── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
