/* ===========================
   main.css — ธีมเหมือนหน้า Login
   =========================== */

:root {
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --accent-color: #DA1212;
    --accent-gradient: linear-gradient(135deg, #DA1212, #c02424, #910a0a);
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: rgba(226, 232, 240, 0.8);
    --font-family: 'Kanit', sans-serif;
    --card-shadow: none;
    --hover-shadow: none;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 20px 10px 40px;
}

/* Background overlay เหมือน Login */
.background-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1;
    background: url('img/srmd.png') no-repeat center center / cover;
}

.background-overlay::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(241, 245, 249, 0.85), rgba(255, 255, 255, 0.6));
    backdrop-filter: blur(2px);
}

/* Container กลาง */
.form-container {
    width: 100%;
    max-width: 650px;
    z-index: 10;
}

/* ===== Header Card — เหมือน Login Card ===== */
.page-header-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0;
    padding: 20px 20px 15px;
    box-shadow: none;
    text-align: center;
    margin-bottom: 15px;
    animation: cardEnter 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes cardEnter {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

.page-header-card .header-logo {
    width: 90px;
    height: 90px;
    object-fit: contain;
    margin-bottom: 18px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.06));
}

.page-header-card h1 {
    font-size: clamp(1rem, 3vw, 1.25rem);
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.03em;
    margin-bottom: 4px;
}

.page-header-card .sub-title {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 400;
    margin-bottom: 15px;
}

/* User Info Bar (อยู่ใน header card) */
.user-info-bar {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
}

.info-details {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 15px;
    font-size: 0.7rem;
    color: #475569;
}

.info-details strong {
    color: var(--accent-color);
    font-weight: 700;
}

.logout-link {
    font-size: 0.68rem;
    padding: 4px 10px;
    background: #fff;
    color: #ff0000;
    border: 1px solid #e2e8f0;
    border-radius: 0;
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
    margin-left: 10px;
    transition: all 0.2s;
    box-shadow: none;
}

.logout-link:hover {
    color: var(--accent-color);
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

/* ===== Progress Steps ===== */
.progress-container {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.progress-steps {
    display: flex;
    gap: 50px;
    position: relative;
    align-items: center;
}

.progress-steps::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 2px;
    background: #e2e8f0;
    z-index: 0;
}

.step {
    width: 34px;
    height: 34px;
    border-radius: 0;
    background: #fff;
    border: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: #94a3b8;
    z-index: 1;
    transition: all 0.3s ease;
    box-shadow: none;
}

.step.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
    box-shadow: none;
}

/* ===== Question Cards ===== */
.question-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0;
    padding: 20px 20px;
    box-shadow: none;
    margin-bottom: 15px;
    display: none;
    animation: fadeIn 0.35s ease-out;
}

.question-card.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.card-title-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f1f5f9;
}

.card-title-section h2 {
    font-size: clamp(0.9rem, 2.8vw, 1rem);
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.section-icon {
    font-size: 1.6rem;
}

/* ===== Form Groups ===== */
.form-group {
    margin-bottom: 22px;
}

.form-group > label {
    display: block;
    font-weight: 600;
    font-size: 0.78rem;
    color: #334155;
    margin-bottom: 8px;
    line-height: 1.4;
}

.form-group.error > label {
    color: var(--accent-color);
}

.inline-hint {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== Inputs ===== */
input[type="text"],
input[type="tel"],
textarea {
    width: 100%;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 0;
    padding: 10px 14px;
    color: #0f172a;
    font-family: var(--font-family);
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

/* Select */
select {
    width: 100%;
    background: #ffffff !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 0 !important;
    padding: 10px 35px 10px 14px !important;
    color: #0f172a !important;
    font-family: var(--font-family);
    font-size: 0.8rem;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 1em !important;
}

select:disabled {
    background-color: #f8fafc !important;
    color: #94a3b8 !important;
    cursor: not-allowed;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 3px rgba(218, 18, 18, 0.1);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

/* ===== Radio & Checkbox ===== */
.radio-group-vertical label,
.checkbox-group-vertical label {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 0;
    margin-bottom: 7px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.radio-group-vertical label:hover,
.checkbox-group-vertical label:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.radio-group-vertical label:has(input:checked),
.checkbox-group-vertical label:has(input:checked) {
    border-color: var(--accent-color);
    border-width: 1.5px;
    box-shadow: none;
}

input[type="radio"],
input[type="checkbox"] {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #cbd5e1;
    margin-right: 12px;
    flex-shrink: 0;
    cursor: pointer;
    position: relative;
    transition: border 0.2s, background 0.2s;
}

input[type="radio"]    { border-radius: 50%; }
input[type="checkbox"] { border-radius: 4px; }

input[type="radio"]:checked,
input[type="checkbox"]:checked {
    border-color: var(--accent-color);
    background: var(--accent-color);
}

input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #fff;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    width: 5px; height: 10px;
    border: solid #fff;
    border-width: 0 2.5px 2.5px 0;
    top: 45%; left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
}

/* Other Input */
.other-input {
    display: none;
    margin-top: 10px;
}

/* ===== Likert Table ===== */
.likert {
    width: 100%;
    border-collapse: separate;
    border-spacing: 4px 0;
    margin-top: 6px;
}

.likert td.scale {
    padding: 14px 4px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 0;
    font-weight: 700;
    color: #64748b;
    font-size: 0.8rem;
}

.likert th {
    font-size: 0.68rem;
    color: #94a3b8;
    font-weight: 500;
    padding: 0 6px;
    white-space: nowrap;
}

.likert .choice-label {
    display: flex;
    justify-content: center;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    margin-bottom: 0;
    font-weight: normal;
    font-size: inherit;
    cursor: default;
}

.likert input[type="radio"] {
    margin: 0;
}

/* ===== Navigation Buttons ===== */
.form-navigation {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 28px;
}

.next-btn,
.prev-btn {
    flex: 1;
    max-width: 320px;
    padding: 12px;
    border-radius: 0;
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.next-btn {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: none;
}

.next-btn:hover {
    transform: translateY(-4px);
    box-shadow: none;
}

.next-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.prev-btn {
    background: #fff;
    color: #64748b;
    border: 1.5px solid #e2e8f0;
    max-width: 160px;
}

.prev-btn:hover {
    border-color: #cbd5e1;
    color: #334155;
    background: #f8fafc;
}

/* ===== Thank-You Card ===== */
#thank-you-message .question-card {
    text-align: center;
    padding: 50px 30px;
}

#thank-you-message p {
    font-size: 1rem;
    color: var(--text-muted);
    margin-top: 8px;
}

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

/* ===== Mobile ===== */
@media (max-width: 480px) {
    body { padding: 12px 8px 30px; }

    .page-header-card { padding: 25px 18px 20px; }
    .page-header-card .header-logo { width: 72px; height: 72px; }

    .user-info-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .logout-link {
        width: 100%;
        text-align: center;
        margin-left: 0;
    }

    .question-card { padding: 22px 16px; }

    .form-navigation { flex-direction: column-reverse; align-items: center; }
    .next-btn, .prev-btn { max-width: 100%; width: 100%; }
}