/* Tablet Registration Form CSS — v1.1.3
   Single-page scroll layout */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@400;500;600&display=swap');

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

/* ── Wrap ────────────────────────────────────────────────── */
.trf-form-wrap {
    max-width: 700px;
    margin: 0 auto;
    font-family: 'Noto Sans Thai', sans-serif;
    font-size: 15px;
    color: #1d2327;
    background: #f4f5f7;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,.10);
}

/* ── Header ──────────────────────────────────────────────── */
.trf-form-header {
    background: linear-gradient(135deg, #185FA5 0%, #0C447C 100%);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.trf-form-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}
.trf-form-subtitle {
    font-size: 13px;
    color: #B5D4F4;
    margin-top: 2px;
}

/* ── Form body: เว้นระยะด้านข้าง ─────────────────────────── */
.trf-form-body {
    padding: 20px 24px 8px;
    background: #fff;
}

/* ── Group divider ───────────────────────────────────────── */
.trf-group-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #185FA5;
    padding: 16px 0 10px;
    border-bottom: 1.5px solid #e0eaf6;
    margin-bottom: 14px;
}
.trf-group-divider--first {
    padding-top: 4px;
}
.trf-group-icon { font-size: 16px; }

.trf-group-desc {
    font-size: 13px;
    color: #787c82;
    margin-top: -8px;
    margin-bottom: 12px;
}

/* ── Fields ──────────────────────────────────────────────── */
.trf-field-wrap {
    margin-bottom: 18px;
}
.trf-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #3c434a;
    margin-bottom: 6px;
}
.trf-required { color: #d63638; font-size: 14px; }
.trf-auto-badge {
    font-size: 11px;
    font-weight: 500;
    color: #27500A;
    background: #EAF3DE;
    border: 1px solid #A8CC7C;
    border-radius: 20px;
    padding: 1px 8px;
}

.trf-input {
    display: block;
    width: 100%;
    padding: 11px 14px;
    font-size: 15px;
    font-family: 'Noto Sans Thai', sans-serif;
    color: #1d2327;
    background: #fff;
    border: 1.5px solid #c3c4c7;
    border-radius: 8px;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
    appearance: none;
}
.trf-input:focus {
    outline: none;
    border-color: #185FA5;
    box-shadow: 0 0 0 3px rgba(24,95,165,.12);
}
.trf-input.is-invalid {
    border-color: #d63638;
    box-shadow: 0 0 0 3px rgba(214,54,56,.10);
}
.trf-textarea { resize: vertical; min-height: 100px; }

/* event date — readonly */
.trf-date-display-wrap .trf-input {
    background: #EAF3DE;
    border-color: #A8CC7C;
    color: #27500A;
    font-weight: 600;
    cursor: default;
}
.trf-date-display-wrap .trf-input:focus {
    border-color: #A8CC7C;
    box-shadow: none;
}

/* ── Field error ─────────────────────────────────────────── */
.trf-field-error {
    font-size: 12px;
    color: #d63638;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.trf-field-error::before { content: '⚠ '; }

/* ── Select ──────────────────────────────────────────────── */
select.trf-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23555' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

/* ── Checkbox ────────────────────────────────────────────── */
.trf-checkbox-group { display: flex; flex-direction: column; gap: 8px; }
.trf-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}
.trf-checkbox { width: 18px; height: 18px; accent-color: #185FA5; cursor: pointer; }

/* ── Signature ───────────────────────────────────────────── */
.trf-signature-wrap {
    border: 1.5px dashed #c3c4c7;
    border-radius: 8px;
    overflow: hidden;
    background: #fafafa;
    position: relative;
}
.trf-signature-canvas {
    display: block;
    width: 100%;
    height: 180px;
    touch-action: none;
    cursor: crosshair;
    background: transparent;
}
.trf-signature-canvas.has-stroke { background: #fff; }
.trf-signature-canvas.is-invalid { border: 2px solid #d63638; }

.trf-signature-guide {
    position: absolute;
    bottom: 42px;
    left: 0; right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    pointer-events: none;
    transition: opacity .2s;
}
.trf-signature-guide.hidden { opacity: 0; }
.trf-sig-line {
    width: 60%;
    height: 1px;
    background: #ccc;
    margin-bottom: 4px;
}
.trf-signature-guide span { font-size: 12px; color: #aaa; }

.trf-signature-actions {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    background: #f4f5f7;
    border-top: 1px solid #e0e0e0;
    justify-content: flex-end;
}
.trf-btn-sig-undo,
.trf-btn-sig-clear {
    font-size: 12px;
    font-family: 'Noto Sans Thai', sans-serif;
    padding: 5px 12px;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    background: #fff;
    color: #555;
    cursor: pointer;
    transition: background .15s;
}
.trf-btn-sig-undo:hover,
.trf-btn-sig-clear:hover { background: #f0f0f1; }
.trf-btn-sig-clear { color: #d63638; border-color: #f5c6c6; }
.trf-btn-sig-clear:hover { background: #fcf0f1; }

/* ── Notice ──────────────────────────────────────────────── */
.trf-notice {
    padding: 14px 18px;
    background: #fcf0f1;
    color: #8a2424;
    border-radius: 8px;
    font-size: 14px;
}

/* ── Footer ──────────────────────────────────────────────── */
.trf-form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 24px;
    background: #f4f5f7;
    border-top: 1px solid #e0e0e0;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

/* ── Buttons ─────────────────────────────────────────────── */
.trf-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 13px 22px;
    font-size: 15px;
    font-family: 'Noto Sans Thai', sans-serif;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s, opacity .15s, transform .08s;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}
.trf-btn:active { transform: scale(.97); }

.trf-btn-primary {
    background: #185FA5;
    color: #fff;
    flex: 1;
    justify-content: center;
}
.trf-btn-primary:hover { background: #0C447C; }

.trf-btn-secondary {
    background: #fff;
    color: #555;
    border: 1.5px solid #c3c4c7;
}
.trf-btn-secondary:hover { background: #f4f5f7; }

/* ── Success ─────────────────────────────────────────────── */
.trf-success-wrap {
    text-align: center;
    padding: 56px 24px;
    background: #fff;
}
.trf-success-icon { font-size: 72px; margin-bottom: 16px; }
.trf-success-wrap h2 { font-size: 24px; color: #27ae60; margin-bottom: 10px; }
.trf-success-wrap p  { font-size: 15px; color: #666; margin-bottom: 28px; line-height: 1.7; }

/* ── Loading ─────────────────────────────────────────────── */
.trf-loading { text-align: center; padding: 56px 24px; background: #fff; }
.trf-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #e0e0e0;
    border-top-color: #185FA5;
    border-radius: 50%;
    animation: trf-spin .8s linear infinite;
    margin: 0 auto 14px;
}
@keyframes trf-spin { to { transform: rotate(360deg); } }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
    .trf-form-body   { padding: 16px 16px 8px; }
    .trf-form-footer { padding: 12px 16px; }
    .trf-btn         { padding: 12px 16px; font-size: 14px; }
    .trf-input       { font-size: 16px; }
}
