/* ===== THEME EXTENSIONS (form-specific) ===== */
[data-theme="warm"] { --star-color: #D4A853; --nps-low: #C4B5A0; --nps-high: #8B7BA8; }
[data-theme="dark"] { --star-color: #E8C96A; --nps-low: #504840; --nps-high: #C8A97E; }
[data-theme="clean"] { --star-color: #D4A853; --nps-low: #94A3B8; --nps-high: #6B8A99; }

body {
    font-family: 'Noto Sans TC', 'Inter', sans-serif;
    background: var(--bg-1); color: var(--text-b);
    line-height: 1.8; font-weight: 400; font-size: 16px;
    transition: background var(--transition-theme), color var(--transition-theme);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    touch-action: manipulation;
}

/* ===== FORM WRAPPER ===== */
.form-wrapper {
    width: 100%;
    max-width: 680px;
    position: relative;
}

/* ===== HEADER ===== */
.form-header {
    text-align: center;
    margin-bottom: 32px;
}
.form-header-logo {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--text-h);
    letter-spacing: 1px;
    margin-bottom: 4px;
    transition: color var(--transition-theme);
}
.form-header-logo em {
    font-style: normal;
    opacity: 0.35;
    font-size: 0.75rem;
    margin-left: 8px;
    letter-spacing: 3px;
    font-family: 'Noto Sans TC', sans-serif;
    font-weight: 300;
}
.form-header h1 {
    font-family: 'Noto Serif TC', 'Cormorant Garamond', serif;
    font-size: 1.6rem;
    font-weight: 500;
    color: var(--text-h);
    margin-top: 12px;
    letter-spacing: 2px;
    transition: color var(--transition-theme);
}
.form-header p {
    font-size: 0.88rem;
    color: var(--text-m);
    margin-top: 8px;
    font-weight: 300;
    transition: color var(--transition-theme);
}

/* ===== STEP INDICATOR ===== */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 36px;
    padding: 0 20px;
}
.step-dot {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.78rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    border: 2px solid var(--line-h);
    color: var(--text-m);
    background: var(--bg-card);
    transition: background 0.5s var(--ease-out-expo), border-color 0.5s var(--ease-out-expo), color 0.5s var(--ease-out-expo), box-shadow 0.5s var(--ease-out-expo);
    position: relative;
    flex-shrink: 0;
    z-index: 1;
}
.step-dot.active {
    border-color: var(--c1);
    color: #fff;
    background: var(--c1);
    transform: scale(1.1);
    box-shadow: 0 0 0 6px rgba(var(--c1-rgb), 0.15);
}
.step-dot.completed {
    border-color: var(--c1);
    color: #fff;
    background: var(--c1);
}
.step-dot.completed .dot-num { display: none; }
.step-dot .dot-check {
    display: none;
    width: 14px; height: 14px;
}
.step-dot.completed .dot-check { display: block; }
.step-line {
    height: 2px;
    width: 60px;
    background: var(--line-h);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
.step-line-fill {
    position: absolute;
    top: 0; left: 0;
    height: 100%; width: 0%;
    background: var(--c1);
    transition: width 0.6s var(--ease-out-expo);
}
.step-line.filled .step-line-fill { width: 100%; }

/* ===== FORM CARD ===== */
.form-card {
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: 0 2px 40px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    transition: background var(--transition-theme), box-shadow var(--transition-theme);
    position: relative;
}
[data-theme="dark"] .form-card {
    box-shadow: 0 2px 40px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.04);
}

.form-card-inner {
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    z-index: 1;
}

.steps-track {
    display: flex;
    transition: transform 0.6s var(--ease-out-expo);
}

.form-step {
    min-width: 100%;
    padding: 40px 44px;
    opacity: 0;
    transform: scale(0.98);
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
}
.form-step.active {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.step-title {
    font-family: 'Noto Serif TC', serif;
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text-h);
    margin-bottom: 28px;
    letter-spacing: 1px;
    transition: color var(--transition-theme);
}

/* ===== FORM FIELD GROUP ===== */
.field-group {
    margin-bottom: 24px;
}
.field-group:last-child { margin-bottom: 0; }

.field-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-h);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
    transition: color var(--transition-theme);
}
.field-desc {
    font-size: 0.78rem;
    color: var(--text-m);
    margin-bottom: 8px;
    font-weight: 300;
}

/* Two-column row for desktop */
.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

/* ===== TEXT INPUT (Floating Label) ===== */
.input-wrap {
    position: relative;
}
.input-wrap input,
.input-wrap textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.92rem;
    font-family: 'Noto Sans TC', 'Inter', sans-serif;
    color: var(--text-h);
    background: var(--bg-card);
    border: 1.5px solid var(--line-h);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s, background var(--transition-theme), color var(--transition-theme);
}
.input-wrap input:focus,
.input-wrap textarea:focus {
    border-color: var(--c1);
    box-shadow: 0 0 0 3px rgba(var(--c1-rgb), 0.1);
}
.input-wrap .float-label {
    position: absolute;
    left: 16px; top: 50%;
    transform: translateY(-50%);
    font-size: 0.88rem;
    color: var(--text-m);
    pointer-events: none;
    transition: top 0.3s var(--ease-out-expo), transform 0.3s var(--ease-out-expo), color 0.3s var(--ease-out-expo);
    transform-origin: left;
}
.input-wrap input:focus ~ .float-label,
.input-wrap input.has-value ~ .float-label {
    top: 10px;
    transform: translateY(0) scale(0.75);
    color: var(--c1);
}

/* ===== CUSTOM SELECT ===== */
.custom-select {
    position: relative;
    user-select: none;
}
.select-trigger {
    width: 100%;
    padding: 12px 16px;
    min-height: 44px;
    font-size: 0.88rem;
    font-family: 'Noto Sans TC', 'Inter', sans-serif;
    color: var(--text-b);
    background: var(--bg-card);
    border: 1.5px solid var(--line-h);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: border-color 0.3s, box-shadow 0.3s, background var(--transition-theme), color var(--transition-theme);
}
.select-trigger:hover { border-color: var(--line-h); }
.select-trigger.open {
    border-color: var(--c1);
    box-shadow: 0 0 0 3px rgba(var(--c1-rgb), 0.1);
}
.select-trigger .placeholder { color: var(--text-m); }
.select-arrow {
    width: 18px; height: 18px;
    transition: transform 0.3s var(--ease-out-expo);
    color: var(--text-m);
}
.select-trigger.open .select-arrow { transform: rotate(180deg); }
.select-dropdown {
    position: fixed;
    background: var(--bg-card);
    border: 1.5px solid var(--line-h);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.1);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s var(--ease-out-expo);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}
.select-dropdown.open {
    opacity: 1;
    pointer-events: auto;
}
.select-option {
    padding: 12px 16px;
    font-size: 0.86rem;
    color: var(--text-b);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    min-height: 44px;
    display: flex;
    align-items: center;
}
.select-option:hover {
    background: rgba(var(--c1-rgb), 0.08);
    color: var(--text-h);
}
.select-option.selected {
    color: var(--c1);
    font-weight: 500;
}

/* ===== DATE PICKER (3 selects) ===== */
.date-row {
    display: flex;
    gap: 10px;
}
.date-row .custom-select { flex: 1; }
.date-row .custom-select:first-child { flex: 1.3; }

/* ===== STAR RATING ===== */
.star-rating-group {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.star-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    direction: rtl;
}
.star-rating input {
    display: none;
}
.star-rating label {
    cursor: pointer;
    transition: transform 0.2s var(--ease-out-expo);
    display: flex;
    align-items: center;
    padding: 6px;
    min-width: 44px; min-height: 44px;
    justify-content: center;
}
.star-rating label:hover { transform: scale(1.2); }
.star-rating label svg {
    width: 32px; height: 32px;
    fill: var(--line-h);
    transition: fill 0.2s ease, transform 0.2s var(--ease-out-expo);
}
.star-rating label:hover svg,
.star-rating label:hover ~ label svg,
.star-rating input:checked ~ label svg {
    fill: var(--star-color);
}
.star-rating label:hover svg {
    transform: scale(1.1);
}
.star-label-text {
    margin-left: 12px;
    font-size: 0.82rem;
    color: var(--text-m);
    transition: color 0.3s;
}
.star-label-text.has-value { color: var(--c1); font-weight: 500; }

/* ===== EMOJI FACE RATING ===== */
.emoji-rating {
    display: flex;
    gap: 16px;
    justify-content: center;
}
.emoji-rating input { display: none; }
.emoji-rating label {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: transform 0.3s var(--ease-out-expo);
    padding: 4px;
    min-width: 44px;
}
.emoji-rating label:hover { transform: scale(1.1); }
.emoji-rating input:checked + label { transform: scale(1.2); }
.emoji-face {
    width: 48px; height: 48px;
    border-radius: 50%;
    border: 2px solid var(--line-h);
    position: relative;
    background: var(--bg-card);
    transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.emoji-rating input:checked + label .emoji-face {
    border-color: var(--c1);
    box-shadow: 0 0 0 4px rgba(var(--c1-rgb), 0.15);
    background: rgba(var(--c1-rgb), 0.06);
}
.emoji-face svg {
    width: 30px; height: 30px;
}
.emoji-face-label {
    font-size: 0.7rem;
    color: var(--text-m);
    transition: color 0.3s;
}
.emoji-rating input:checked + label .emoji-face-label {
    color: var(--c1);
    font-weight: 500;
}

/* ===== CHECKBOX CARDS ===== */
.checkbox-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.checkbox-card {
    position: relative;
}
.checkbox-card input { display: none; }
.checkbox-card label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1.5px solid var(--line-h);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.84rem;
    color: var(--text-b);
    background: var(--bg-card);
    transition: border-color 0.3s var(--ease-out-expo), background 0.3s var(--ease-out-expo), transform 0.3s var(--ease-out-expo);
    min-height: 44px;
}
.checkbox-card label:hover {
    border-color: rgba(var(--c1-rgb), 0.3);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transform: translateY(-1px);
}
.checkbox-card input:checked + label {
    border-color: var(--c1);
    background: rgba(var(--c1-rgb), 0.04);
    color: var(--text-h);
}
.check-box {
    width: 20px; height: 20px;
    border: 1.5px solid var(--line-h);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.3s var(--ease-out-expo), border-color 0.3s var(--ease-out-expo);
    background: transparent;
}
.checkbox-card input:checked + label .check-box {
    background: var(--c1);
    border-color: var(--c1);
}
.check-box svg {
    width: 12px; height: 12px;
    stroke: #fff;
    stroke-width: 2.5;
    fill: none;
    stroke-dasharray: 16;
    stroke-dashoffset: 16;
    transition: stroke-dashoffset 0.3s ease 0.1s;
}
.checkbox-card input:checked + label .check-box svg {
    stroke-dashoffset: 0;
}

/* ===== TEXTAREA ===== */
.textarea-wrap {
    position: relative;
}
.textarea-wrap textarea {
    width: 100%;
    min-height: 120px;
    padding: 14px 16px;
    font-size: 0.88rem;
    font-family: 'Noto Sans TC', 'Inter', sans-serif;
    color: var(--text-h);
    background: var(--bg-card);
    border: 1.5px solid var(--line-h);
    border-radius: 8px;
    outline: none;
    resize: vertical;
    line-height: 1.7;
    transition: border-color 0.3s, box-shadow 0.3s, background var(--transition-theme), color var(--transition-theme);
}
.textarea-wrap textarea:focus {
    border-color: var(--c1);
    box-shadow: 0 0 0 3px rgba(var(--c1-rgb), 0.1);
    min-height: 160px;
}
.char-counter {
    text-align: right;
    font-size: 0.72rem;
    color: var(--text-m);
    margin-top: 4px;
    font-family: 'Inter', sans-serif;
    transition: color var(--transition-theme);
}
.char-counter.near-limit { color: var(--c2); }
.char-counter.at-limit { color: #D35D5D; }

/* ===== NPS SLIDER ===== */
.nps-slider-wrap {
    text-align: center;
}
.nps-value {
    font-family: 'Inter', sans-serif;
    font-size: 2.4rem;
    font-weight: 600;
    color: var(--text-m);
    line-height: 1;
    margin-bottom: 4px;
    transition: color 0.4s var(--ease-out-expo);
}
.nps-emoji {
    font-size: 1.6rem;
    min-height: 1.8em;
    margin-bottom: 16px;
    transition: transform 0.3s var(--ease-out-expo);
}
.nps-track-wrap {
    position: relative;
    padding: 0 6px;
}
.nps-track {
    position: absolute;
    top: 50%; left: 6px; right: 6px;
    height: 6px;
    background: var(--line-h);
    border-radius: 3px;
    transform: translateY(-50%);
    pointer-events: none;
    overflow: hidden;
}
.nps-track-fill {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    transition: width 0.15s ease, background 0.4s var(--ease-out-expo);
}
.nps-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 44px;
    background: transparent;
    cursor: pointer;
    position: relative;
    z-index: 1;
    margin: 0;
}
.nps-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 3px solid var(--nps-thumb-color, var(--c1));
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: border-color 0.4s var(--ease-out-expo), box-shadow 0.3s, transform 0.2s;
}
.nps-range::-moz-range-thumb {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 3px solid var(--nps-thumb-color, var(--c1));
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: border-color 0.4s var(--ease-out-expo), box-shadow 0.3s, transform 0.2s;
}
.nps-range:active::-webkit-slider-thumb {
    transform: scale(1.2);
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}
.nps-range:active::-moz-range-thumb {
    transform: scale(1.2);
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}
.nps-range::-webkit-slider-runnable-track {
    height: 6px;
    background: transparent;
}
.nps-range::-moz-range-track {
    height: 6px;
    background: transparent;
    border: none;
}
.nps-ticks {
    display: flex;
    justify-content: space-between;
    padding: 6px 0 0;
    font-size: 0.68rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-m);
    pointer-events: none;
}
.nps-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-size: 0.72rem;
    color: var(--text-m);
}
.nps-result {
    margin-top: 16px;
    font-size: 0.88rem;
    font-weight: 500;
    min-height: 1.4em;
    opacity: 0;
    transition: opacity 0.3s, color 0.4s var(--ease-out-expo);
}
.nps-result.visible { opacity: 1; }

/* ===== RADIO CARDS ===== */
.radio-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.radio-card {
    position: relative;
}
.radio-card input { display: none; }
.radio-card label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 10px;
    border: 1.5px solid var(--line-h);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-b);
    background: var(--bg-card);
    text-align: center;
    min-height: 44px;
    transition: border-color 0.3s var(--ease-out-expo), background 0.3s var(--ease-out-expo), transform 0.3s var(--ease-out-expo);
}
.radio-card label:hover {
    border-color: rgba(var(--c1-rgb), 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.radio-card input:checked + label {
    border-color: var(--c1);
    background: var(--c1);
    color: #fff;
    box-shadow: 0 4px 16px rgba(var(--c1-rgb), 0.25);
}

/* ===== NAVIGATION BUTTONS ===== */
.form-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 44px 32px;
    border-top: 1px solid var(--line);
    position: relative;
    z-index: 10;
}
.btn-prev {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--text-m);
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Noto Sans TC', sans-serif;
    padding: 10px 16px;
    min-height: 44px;
    transition: color 0.3s, transform 0.3s;
    letter-spacing: 0.5px;
}
.btn-prev:hover {
    color: var(--text-h);
    transform: translateX(-2px);
}
.btn-prev svg {
    width: 16px; height: 16px;
    transition: transform 0.3s var(--ease-out-expo);
}
.btn-prev:hover svg { transform: translateX(-3px); }

.btn-next {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    letter-spacing: 1px;
    font-weight: 500;
    padding: 14px 36px;
    border-radius: 100px;
    border: 1.5px solid var(--text-h);
    color: var(--text-h);
    cursor: pointer;
    font-family: 'Noto Sans TC', 'Inter', sans-serif;
    min-height: 44px;
    background: linear-gradient(to right, var(--text-h) 50%, transparent 50%);
    background-size: 200% 100%;
    background-position: right;
    transition: color 0.5s var(--ease-out-expo), background-position 0.5s var(--ease-out-expo), border-color var(--transition-theme);
}
.btn-next:hover { color: var(--bg-1); background-position: left; }
.btn-next svg {
    width: 16px; height: 16px;
    transition: transform 0.3s var(--ease-out-expo);
}
.btn-next:hover svg { transform: translateX(3px); }

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

/* ===== THANK YOU SCREEN ===== */
.thank-you {
    display: none;
    text-align: center;
    padding: 60px 44px;
}
.thank-you.active { display: block; }
.thank-check-circle {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: var(--c1);
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: scaleIn 0.6s var(--ease-out-expo) forwards;
}
@keyframes scaleIn {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
.thank-check-circle svg {
    width: 36px; height: 36px;
    stroke: #fff;
    stroke-width: 2.5;
    fill: none;
    stroke-dasharray: 60;
    stroke-dashoffset: 60;
    animation: drawCheck 0.6s ease 0.4s forwards;
}
@keyframes drawCheck {
    to { stroke-dashoffset: 0; }
}
.thank-you h2 {
    font-family: 'Noto Serif TC', serif;
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--text-h);
    margin-bottom: 12px;
    letter-spacing: 2px;
    animation: fadeUp 0.5s ease 0.3s both;
}
.thank-you p {
    font-size: 0.88rem;
    color: var(--text-m);
    font-weight: 300;
    line-height: 1.8;
    animation: fadeUp 0.5s ease 0.5s both;
}
@keyframes fadeUp {
    0% { opacity: 0; transform: translateY(12px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    body { padding: 24px 12px; justify-content: flex-start; }
    .form-step { padding: 28px 24px; }
    .form-nav { padding: 16px 24px 24px; }
    .form-header h1 { font-size: 1.3rem; }
    .field-row { grid-template-columns: 1fr; gap: 16px; }
    .checkbox-cards { grid-template-columns: 1fr; }
    .radio-cards { grid-template-columns: 1fr 1fr; }
    .step-line { width: 36px; }
    .emoji-rating { gap: 10px; }
    .emoji-face { width: 44px; height: 44px; }
    .star-rating { gap: 8px; }
    .star-rating label svg { width: 36px; height: 36px; }
    .btn-next { padding: 12px 28px; font-size: 0.8rem; min-height: 44px; }
}
