/* ============================================================
   Design System — FDM Malaysia 2026 Visitor Form
   ============================================================ */

/* --- Typography --- */
:root {
    --font-head: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

    --fs-eyebrow: .65rem;
    --fs-label: .9rem;
    --fs-input: .9375rem;
    --fs-body: .9375rem;
    --fs-section: 1.0625rem;
    --fs-title: 1.375rem;

    --fw-reg: 400;
    --fw-med: 500;
    --fw-semi: 600;
    --fw-bold: 700;
    --lh-tight: 1.3;
    --lh-body: 1.5;
}

/* --- Neutral tokens --- */
:root {
    --c-ink: #1F2430;
    --c-muted: #6B7280;
    --c-line: #b8b8b8;
    --c-surface: #FFFFFF;
    --c-field: #F4F6F9;
    --c-danger: #D92D20;
    --c-success: #12805C;
    --c-warning: #B54708;

    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;

    --shadow-card: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.06);
}

/* --- Theme per visitor type --- */
.theme-online {
    --theme-primary: #C2570A;
    --theme-primary-600: #863b06;
    --theme-soft: #ed972dd1;
    --theme-bg: #FFF7EC;
    --theme-accent: #C2570A;
    --theme-ring: rgba(194,87,10,.25);
}
.theme-vip {
    --theme-primary: #243353;
    --theme-primary-600: #0b0f18;
    --theme-soft: #dba511;
    --theme-bg: #F7F4ED;
    --theme-accent: #B68A2E;
    --theme-ring: rgba(36,51,83,.25);
}
.theme-leads {
    --theme-primary: #0E7C6B;
    --theme-primary-600: #0A6357;
    --theme-soft: #D7EFEA;
    --theme-bg: #EEF8F5;
    --theme-accent: #0E7C6B;
    --theme-ring: rgba(14,124,107,.25);
}
.theme-onsite {
    --theme-primary: #C0392B;
    --theme-primary-600: #7c281e;
    --theme-soft: #e33b19;
    --theme-bg: #FCF0ED;
    --theme-accent: #C0392B;
    --theme-ring: rgba(192,57,43,.25);
}
.theme-selfreg {
    --theme-primary: #2459B8;
    --theme-primary-600: #16346d;
    --theme-soft: #89aff7;
    --theme-bg: #EFF4FD;
    --theme-accent: #2459B8;
    --theme-ring: rgba(36,89,184,.25);
}
.theme-seminar {
    --theme-primary: #5340A8;
    --theme-primary-600: #443488;
    --theme-soft: #E5E0F5;
    --theme-bg: #F1EEFB;
    --theme-accent: #5340A8;
    --theme-ring: rgba(83,64,168,.25);
}

/* --- Base --- */
body {
    background: var(--theme-bg);
    color: var(--c-ink);
    font-family: var(--font-body);
    font-size: var(--fs-body);
    line-height: var(--lh-body);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* --- Page wrapper --- */
.page-wrapper {
    min-height: 100vh;
    padding: var(--space-4) var(--space-3);
}

/* --- Banner --- */
.form-banner {
    margin-bottom: var(--space-6);
}
.banner-title {
    font-family: var(--font-head);
    font-weight: var(--fw-bold);
    font-size: 1.5rem;
    color: var(--theme-primary);
    margin-bottom: var(--space-1);
}
.banner-subtitle {
    font-size: var(--fs-body);
    color: var(--c-muted);
    margin: 0;
}

/* --- Form card --- */
.form-card {
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    max-width: 1000px;
    margin: 0 auto;
    overflow: hidden;
}
.form-card-header {
    background: var(--theme-soft);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--c-line);
}
.form-title {
    font-family: var(--font-head);
    font-weight: var(--fw-bold);
    font-size: var(--fs-title);
    color: var(--c-ink);
    margin: 0 0 var(--space-1) 0;
}
.form-subtitle {
    font-size: var(--fs-eyebrow);
    color: var(--c-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 0;
}
.form-card-body {
    padding: var(--space-5);
}

/* --- Section titles --- */
.section-title {
    font-family: var(--font-head);
    font-weight: var(--fw-bold);
    font-size: var(--fs-section);
    color: var(--c-ink);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-2);
    border-bottom: 2px solid var(--theme-soft);
}
.form-section {
    margin-bottom: var(--space-6);
}

/* --- Labels --- */
.form-label {
    font-size: var(--fs-label);
    font-weight: var(--fw-semi);
    color: var(--c-ink);
    margin-bottom: var(--space-2);
    font-family: var(--font-head);
}
.required-mark {
    color: var(--c-danger);
    margin-left: 2px;
}

/* --- Helper text --- */
.helper-text {
    font-size: var(--fs-eyebrow);
    color: var(--c-muted);
    text-transform: uppercase;
    letter-spacing: .01em;
    margin-bottom: var(--space-3);
}

/* --- Input / Select / Textarea --- */
.form-control,
.form-select {
    height: 44px;
    background: var(--c-field);
    border: 1px solid var(--c-line);
    border-radius: var(--radius);
    font-size: var(--fs-input);
    font-family: var(--font-body);
    color: var(--c-ink);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control::placeholder {
    color: var(--c-muted);
}
.form-control:focus,
.form-select:focus {
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 3px var(--theme-ring);
    background: var(--c-surface);
}
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--c-danger);
}
.invalid-feedback {
    font-size: var(--fs-eyebrow);
    color: var(--c-danger);
}

/* --- Select2 overrides --- */
.select2-container--bootstrap-5 .select2-selection {
    min-height: 44px;
    border-radius: var(--radius);
    border: 1px solid var(--c-line);
    background: var(--c-field);
    font-size: var(--fs-input);
    font-family: var(--font-body);
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    line-height: 32px;
    color: var(--c-ink);
}
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 3px var(--theme-ring);
}
.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background: var(--theme-soft) !important;
    color: var(--c-ink) !important;
}
.select2-container {
    width: 100% !important;
}

/* --- Radio pills (salutation) --- */
.salutation-pills {
    display: flex;
    gap: var(--space-2);
}
.pill-radio {
    cursor: pointer;
}
.pill-radio-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.pill-radio-label {
    display: inline-block;
    padding: var(--space-2) var(--space-5);
    border: 1px solid var(--c-line);
    border-radius: 999px;
    font-size: var(--fs-label);
    font-weight: var(--fw-semi);
    font-family: var(--font-head);
    color: var(--c-ink);
    background: var(--c-surface);
    transition: all .15s ease;
    user-select: none;
}
.pill-radio-input:checked + .pill-radio-label {
    background: var(--theme-primary);
    border-color: var(--theme-primary);
    color: #fff;
}
.pill-radio-input:focus-visible + .pill-radio-label {
    box-shadow: 0 0 0 3px var(--theme-ring);
}

/* --- Sub-interest per-group sections --- */
#checks_job_sub_interest {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}
.sub-interest-section {
    padding: var(--space-4);
    background: var(--c-field);
    border-radius: var(--radius);
    border: 1px solid var(--c-line);
}
.sub-interest-section .form-label {
    font-size: var(--fs-label);
    margin-bottom: var(--space-1);
}
.sub-interest-parent-name {
    color: var(--theme-primary);
    font-weight: var(--fw-bold);
}

/* --- Toggle card (checkbox groups) --- */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
}
.toggle-card {
    cursor: pointer;
    display: block;
}
.toggle-card-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.toggle-card-label {
    display: flex;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--c-line);
    border-radius: var(--radius);
    font-size: var(--fs-label);
    font-family: var(--font-body);
    color: var(--c-ink);
    background: var(--c-surface);
    transition: all .15s ease;
    min-height: 44px;
    user-select: none;
}
.toggle-card-label::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--c-line);
    border-radius: 4px;
    margin-right: var(--space-3);
    flex-shrink: 0;
    transition: all .15s ease;
}
.toggle-card-input:checked + .toggle-card-label {
    background: var(--theme-soft);
    border-color: var(--theme-primary);
}
.toggle-card-input:checked + .toggle-card-label::before {
    background: var(--theme-accent);
    border-color: var(--theme-accent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23fff' d='M10.28 2.28a.75.75 0 0 1 0 1.06l-5.5 5.5a.75.75 0 0 1-1.06 0l-2.5-2.5a.75.75 0 1 1 1.06-1.06L4.25 7.25l4.97-4.97a.75.75 0 0 1 1.06 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}
.toggle-card-input:focus-visible + .toggle-card-label {
    box-shadow: 0 0 0 3px var(--theme-ring);
}
.toggle-card.disabled .toggle-card-label {
    opacity: .5;
    pointer-events: none;
}

/* --- Consent checkbox --- */
.consent-check .form-check-input {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    border-color: var(--c-line);
}
.consent-check .form-check-input:checked {
    background-color: var(--theme-primary);
    border-color: var(--theme-primary);
}
.consent-check .form-check-input:focus {
    box-shadow: 0 0 0 3px var(--theme-ring);
}
.consent-check .form-check-label {
    font-size: var(--fs-label);
    color: var(--c-ink);
    line-height: var(--lh-body);
    padding-left: var(--space-2);
}

/* --- Phone input group --- */
.phone-input-group {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
}
.phone-input-group .select2-container {
    flex: 0 0 110px !important;
    width: 110px !important;
}
.phone-input-group .select2-container .select2-selection {
    height: 44px !important;
    min-height: 44px !important;
    padding-top: 0;
    padding-bottom: 0;
    border-radius: var(--radius) 0 0 var(--radius);
    border-right: 2px solid var(--c-line);
}
.phone-input-group .select2-container .select2-selection--single .select2-selection__rendered {
    line-height: 42px;
}
.phone-input-group .select2-container .select2-selection--single .select2-selection__arrow {
    height: 42px;
}
/* Phone code dropdown (appended to body by Select2) */
.phone-code-dropdown {
    width: 280px !important;
    min-width: 280px !important;
}
.phone-input-group .form-control {
    flex: 1 1 auto;
    min-width: 0;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* --- Submit button --- */
.btn-submit {
    background: var(--theme-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-6);
    font-size: var(--fs-input);
    font-weight: var(--fw-semi);
    font-family: var(--font-head);
    min-height: 48px;
    min-width: 200px;
    transition: background .15s ease;
    cursor: pointer;
}
.btn-submit:hover {
    background: var(--theme-primary-600);
    color: #fff;
}
.btn-submit:focus-visible {
    box-shadow: 0 0 0 3px var(--theme-ring);
}
.btn-submit:disabled {
    opacity: .65;
    cursor: not-allowed;
}

/* --- Barcode display (thank you page) --- */
.barcode-display {
    padding: var(--space-5);
    background: var(--c-field);
    border-radius: var(--radius);
    display: inline-block;
}

/* --- Responsive --- */
@media (max-width: 576px) {
    .form-title {
        font-size: 1.25rem;
    }
    .banner-title {
        font-size: 1.25rem;
    }
    .form-card-body {
        padding: var(--space-3);
    }
    .form-card-header {
        padding: var(--space-3);
    }
    .checkbox-grid {
        grid-template-columns: 1fr;
    }
    .btn-submit {
        width: 100%;
    }
    .salutation-pills {
        flex-wrap: wrap;
    }
    .phone-input-group .select2-container {
        flex: 0 0 110px !important;
        width: 110px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}
