/* --- 1. Design System: Variables & Body --- */
:root {
    --momo-red: #E60012;
    --dark-gray: #333333;
    --medium-gray: #888888;
    --light-gray: #f7f7f7;
    --white: #FFFFFF;
    --border-color: #e0e0e0;
    --border-radius: 8px;
    --font-family: 'Kanit', sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: var(--light-gray);
    color: var(--dark-gray);
    margin: 0;
    padding: 2rem 1rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- 2. Layout & Container --- */
.survey-container {
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--white);
    padding: 2rem 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.07);
}

.logo {
    display: block;
    margin: 0 auto 1.5rem auto;
    max-width: 220px;
}

.language-switcher {
    text-align: right;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.language-switcher a {
    color: var(--medium-gray);
    text-decoration: none;
    transition: color 0.3s;
}
.language-switcher a:hover {
    color: var(--momo-red);
}


/* --- 3. Typography & Section Headers --- */
h1 {
    color: var(--momo-red);
    font-weight: 700;
    text-align: center;
    font-size: 2rem;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

p.lead {
    text-align: center;
    font-size: 1.1rem;
    color: var(--dark-gray);
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.section-header {
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--white);
    background-color: var(--momo-red);
    padding: 10px 20px;
    border-radius: var(--border-radius);
    margin: 3rem 0 2rem 0;
    text-align: center;
}


/* --- 4. Form Elements & UI Components --- */
.question-group {
    margin-bottom: 2.5rem;
}

.question-group .title {
    display: block;
    font-weight: 500;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--dark-gray);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: var(--font-family);
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
}
.form-control:focus {
    border-color: var(--momo-red);
    box-shadow: 0 0 0 3px rgba(230, 0, 18, 0.15);
    outline: none;
}

/* Custom Radio & Checkbox */
.custom-radio, .custom-checkbox {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    cursor: pointer;
    font-size: 1rem;
}
.custom-radio input, .custom-checkbox input {
    display: none;
}
.custom-radio .checkmark, .custom-checkbox .checkmark {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: 2px solid var(--border-color);
    display: inline-block;
    margin-right: 12px;
    position: relative;
    transition: all 0.2s;
}
.custom-radio .checkmark { border-radius: 50%; }
.custom-checkbox .checkmark { border-radius: 4px; }

.custom-radio input:checked + .checkmark,
.custom-checkbox input:checked + .checkmark {
    border-color: var(--momo-red);
    background-color: var(--momo-red);
}
.custom-checkbox input:checked + .checkmark::after {
    content: '✔';
    color: var(--white);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
}
.custom-radio input:checked + .checkmark::after {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--white);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem 1rem;
}

/* --- 5. Specific Question Styles --- */
/* Satisfaction Table (Q4) */
.table-responsive { overflow-x: auto; }
.satisfaction-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.satisfaction-table th, .satisfaction-table td {
    padding: 12px 8px;
    text-align: center;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}
.satisfaction-table th { font-weight: 500; }
.satisfaction-table td:first-child { text-align: left; }
.satisfaction-table tr:nth-child(even) { background-color: var(--light-gray); }
.satisfaction-table img { max-width: 30px; margin-bottom: 5px; }
.satisfaction-table input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--momo-red);
}

/* NPS Scale (Q6) */
.nps-scale .nps-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--medium-gray);
    margin-bottom: 0.5rem;
}
.nps-scale .nps-points {
    display: flex;
    justify-content: space-between;
}
.nps-point {
    cursor: pointer;
}
.nps-point input {
    display: none;
}
.nps-point .point-box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: all 0.2s;
}
.nps-point:hover .point-box {
    border-color: var(--momo-red);
    background-color: #fff5f6;
}
.nps-point input:checked + .point-box {
    background-color: var(--momo-red);
    color: var(--white);
    border-color: var(--momo-red);
}

/* Brand Inputs (Q9) */
.brand-inputs label {
    display: block;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 400;
}
.brand-inputs label:first-child {
    margin-top: 0;
}

/* Personal Info (Q10) */
p.info-text {
    font-size: 0.9rem;
    color: var(--medium-gray);
    margin-bottom: 1.5rem;
}
.personal-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* --- 6. Buttons --- */
.button-group {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}
.btn {
    padding: 12px 35px;
    font-family: var(--font-family);
    font-size: 1.1rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 10px;
}
.btn-submit {
    background-color: var(--momo-red);
    color: var(--white);
}
.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(230, 0, 18, 0.3);
}
.btn-reset {
    background-color: #e0e0e0;
    color: var(--dark-gray);
}
.btn-reset:hover {
    background-color: #c7c7c7;
}

/* --- 7. Responsive Adjustments --- */
@media (max-width: 768px) {
    body { padding: 1rem 0.5rem; }
    .survey-container { padding: 1.5rem; }
    h1 { font-size: 1.8rem; }
    .section-header { font-size: 1.2rem; }
    .personal-info-grid { grid-template-columns: 1fr; }
    .button-group .btn { display: block; width: 100%; margin: 10px 0; }
}

@media (max-width: 480px) {
    .nps-scale .nps-points {
        display: flex;
        flex-wrap: nowrap;      /* <<< คำสั่งสำคัญ: บังคับให้อยู่ในแถวเดียวเสมอ */
        justify-content: space-between; /* จัดให้ปุ่มกระจายตัวเต็มความกว้าง */
        gap: 2px;               /* ลดระยะห่างระหว่างปุ่มให้น้อยที่สุด */
    }
    
    .nps-point .point-box {
        width: 25px;            /* ลดความกว้างของปุ่มให้เล็กที่สุด */
        height: 32px;           /* ลดความสูงลงเล็กน้อย */
        line-height: 32px;      /* จัดตัวเลขให้อยู่กลาง */
        font-size: 0.75rem;     /* ลดขนาดตัวเลขให้เล็กลงไปอีก */
        padding: 0;
        box-sizing: border-box;
    }

    .checkbox-grid {
        grid-template-columns: 1fr;
    }
}