/* === UNIVERSAL BOX-SIZING RESET (THE FIX) === */
*, *::before, *::after {
    box-sizing: border-box;
}

/* === BASE STYLES & VARIABLES === */
:root {
    --primary-color: #FF6F00; /* ส้ม */
    --secondary-color: #FFFFFF;
    --text-color: #333333;
    --border-color: #CCCCCC;
    --bg-color: #f4f4f9;
}

body {
    font-family: 'Kanit', sans-serif;
    background: var(--bg-color);
    background-image: linear-gradient(120deg, #fdfbfb 0%, #ebedee 100%);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    line-height: 1.6;
    display: flex; /* CHANGED: For sticky footer */
    flex-direction: column; /* CHANGED: For sticky footer */
    min-height: 100vh; /* CHANGED: For sticky footer */
}

.container {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    flex-grow: 1; /* CHANGED: For sticky footer */
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
    /* CHANGED: Added flex for logo alignment */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

/* CHANGED: Added logo style */
.site-logo {
    max-width: 100px; /* สามารถปรับขนาดได้ตามต้องการ */
    height: auto;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 0.2em;
}

header h2 {
    font-weight: 400;
    color: #555;
}

/* === GLASSMORPHISM CARD STYLE === */
.card {
    background: rgba(255, 255, 255, 0.6);
    border-radius: 15px;
    padding: 30px;
    border: 1px solid rgba(204, 204, 204, 0.5);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    margin-bottom: 20px;
}

section {
    margin-bottom: 25px;
}

h3 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

/* === BUTTONS & GENERAL FORM ELEMENTS === */
.button-group {
    text-align: center;
    margin-top: 30px;
}

.btn {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    display: inline-block;
    margin: 5px;
}

.btn:hover {
    background-color: #e66000;
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: #6c757d;
}
.btn-secondary:hover {
    background-color: #5a6268;
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}
.form-group.full-width {
    grid-column: 1 / -1;
}

label {
    margin-bottom: 5px;
    font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.8);
    font-family: 'Kanit', sans-serif;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(255, 111, 0, 0.5);
}

textarea {
    resize: vertical;
}

/* === LOADING OVERLAY & RESULT STYLES === */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 1000;
}

.spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid var(--primary-color);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay p {
    margin-top: 20px;
    font-size: 1.2em;
    color: var(--primary-color);
}

.ref-id {
    background-color: #fff3e0;
    color: var(--primary-color);
    padding: 10px;
    border-radius: 5px;
    font-weight: bold;
    text-align: center;
}

/* === INDEX.HTML ENHANCEMENTS === */
.styled-list {
    list-style: none;
    padding-left: 20px;
}
.styled-list li {
    padding-left: 25px;
    position: relative;
    margin-bottom: 10px;
}
.styled-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}
.styled-list.benefits li::before {
    content: '✨';
}
.note {
    background-color: rgba(255, 111, 0, 0.08);
    border-left: 4px solid var(--primary-color);
    padding: 10px 15px;
    border-radius: 5px;
    margin-top: 15px;
}
.highlight {
    font-size: 1.1em;
    font-weight: 500;
    color: var(--primary-color);
    text-align: center;
    background-color: #fff3e0;
    padding: 10px;
    border-radius: 8px;
}
.cost-list {
    list-style: none;
    padding: 0;
    margin-bottom: 15px;
}
.cost-list li {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}
.cost-list li:last-child {
    border-bottom: none;
}
.cost-list li span {
    font-weight: 500;
    color: #333;
}
.closing-remark {
    text-align: center;
    font-size: 1.2em;
    font-weight: 500;
    margin-top: 25px;
    color: var(--primary-color);
}

/* === REGISNONYKYE.HTML ENHANCEMENTS === */
#pdpa-section {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    background-color: rgba(249, 249, 249, 0.7);
}
.pdpa-box {
    background-color: var(--secondary-color);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 15px;
    font-size: 0.9em;
    color: #555;
}
.pdpa-box h4 {
    margin-top: 0;
    color: var(--text-color);
}
.pdpa-box ul {
    padding-left: 20px;
}

/* === LOGIN.HTML ENHANCEMENTS === */
.login-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 80vh;
}
.login-card {
    max-width: 450px;
    margin: 0 auto;
    width: 100%;
    padding: 40px;
    border-top: 5px solid var(--primary-color);
}
.form-icon {
    text-align: center;
    margin-bottom: 20px;
    color: var(--primary-color);
}
.form-helper-text {
    text-align: center;
    color: #666;
    margin-bottom: 25px;
    font-size: 0.95em;
}
.input-wrapper {
    position: relative;
}
.input-wrapper .input-icon {
    position: absolute;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
    font-weight: bold;
}
.input-wrapper input {
    padding-left: 45px !important;
}
.btn-full {
    width: 100%;
    padding: 15px;
    font-size: 1.2em;
    margin-top: 10px;
}
.error-message {
    display: none;
    background-color: rgba(217, 83, 79, 0.1);
    border: 1px solid rgba(217, 83, 79, 0.5);
    color: #a94442;
    padding: 10px 15px;
    border-radius: 5px;
    margin-top: 15px;
    text-align: center;
}
.form-footer {
    text-align: center;
    margin-top: 20px;
}
.form-footer a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s;
}
.form-footer a:hover {
    color: var(--primary-color);
}

/* === ANSWER.HTML ENHANCEMENTS === */
.header-answer { /* CHANGED: New style for answer page header */
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    text-align: left;
    gap: 20px;
}
.header-content {
    text-align: left;
}
.btn-logout {
    padding: 8px 15px;
    font-size: 0.9em;
}
.question-block {
    margin-bottom: 30px;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    border: 1px solid rgba(204, 204, 204, 0.3);
}
.question-block label {
    display: block;
    margin-bottom: 10px;
    line-height: 1.7;
    color: #333;
}
.question-block label p {
    margin-bottom: 0.5em;
}
#video-submission h4 {
    margin-top: 25px;
    margin-bottom: 10px;
    color: var(--primary-color);
    font-weight: 500;
}
.styled-list.video-guide li::before {
    content: '🎬';
    margin-right: 5px;
}
ol.styled-list.steps {
    list-style-type: none;
    counter-reset: step-counter;
    padding-left: 0;
}
ol.styled-list.steps li {
    counter-increment: step-counter;
    margin-bottom: 10px;
    padding-left: 35px;
    position: relative;
}
ol.styled-list.steps li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    width: 25px;
    height: 25px;
    background: var(--primary-color);
    color: white;
    text-align: center;
    border-radius: 50%;
    font-weight: bold;
    line-height: 25px;
}
blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 15px;
    margin: 10px 0 10px 15px;
    font-style: italic;
    color: #555;
    background-color: #f9f9f9;
    border-radius: 0 5px 5px 0;
}
.button-group-center {
    text-align: center;
    margin-top: 30px;
}
.result-card {
    text-align: center;
    padding: 40px;
}
.result-card h3 {
    font-size: 2em;
    margin-bottom: 15px;
}
.result-success h3 {
    color: #28a745;
}
.result-error h3 {
    color: #dc3545;
}

/* === NEW: SITE FOOTER === */
.site-footer {
    width: 100%;
    background-color: #333;
    color: #ccc;
    text-align: center;
    padding: 20px 10px;
    margin-top: 40px;
    font-size: 0.9em;
}
.site-footer p {
    margin: 5px 0;
}
.site-footer a {
    color: #fff;
    text-decoration: underline;
    transition: color 0.3s;
}
.site-footer a:hover {
    color: var(--primary-color);
}


/* === RESPONSIVE DESIGN === */
@media (max-width: 768px) {
    /* กฎทั่วไปสำหรับหน้าจอเล็ก */
    .form-grid {
        grid-template-columns: 1fr;
    }
    header h1 {
        font-size: 2em;
    }

    /* 
    --- การแก้ไขสำหรับหน้า Login บนมือถือ --- 
    */
    body {
        padding: 10px; /* ลดระยะห่างขอบของหน้าเว็บ */
    }

    .login-card {
        padding: 25px; /* ลดระยะห่างภายในของการ์ด Login */
    }

    .btn-full {
        padding: 12px; /* ลดขนาดปุ่มให้พอดี */
        font-size: 1.1em;
    }

    .header-answer { /* CHANGED */
        flex-direction: column;
        text-align: center;
    }
    .header-content { /* CHANGED */
        text-align: center;
    }
}