/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-thai, 'Prompt', system-ui, -apple-system, 'Segoe UI', 'Tahoma', 'Arial', sans-serif);
    min-height: 100vh;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: #fff;
    overflow-x: hidden;
    animation: pageFadeIn 0.6s ease-out;
    margin: 0;
    padding: 0;
}

/* Responsive Background Images */
/* Mobile - Default */
body {
    background-image: url('../img/bg_m.jpg');
}

/* Tablet */
@media (min-width: 768px) and (max-width: 1024px) {
    body {
        background-image: url('../img/bg_t.jpg');
    }
}

/* Desktop */
@media (min-width: 1025px) {
    body {
        background-image: url('../img/bg_d.jpg');
    }
}

/* Container */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    animation: cardSlideUp 0.6s ease-out;
}

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding-top: 20px;
}

.login-page .header {
    padding-top: 20px;
}

.home-page .header,
.myqr-page .header {
    padding-top: 10px;
    margin-bottom: 20px;
}

.logo {
    width: 100%;
    max-width: 100%;
    height: auto;
    margin-bottom: 0px;
    animation: logoFloat 3s ease-in-out infinite;
}

.brand-name {
    font-size: 28px;
    font-weight: bold;
    color: #fff;
    text-transform: uppercase;
    line-height: 1.2;
    margin-bottom: 15px;
}

.brand-icon {
    font-size: 24px;
}

.event-title {
    margin-top: 15px;
}

.event-subtitle {
    font-size: 14px;
    color: #87CEEB;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
}

.event-name {
    font-size: 36px;
    font-weight: bold;
    color: #fff;
    text-transform: uppercase;
    margin-top: 5px;
    letter-spacing: 2px;
}

.up-text {
    color: #87CEEB;
}

/* Login Form */
.login-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
    padding-bottom: 250px;
}

.form-group {
    width: 100%;
}

.form-hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    margin-top: 5px;
    letter-spacing: 1px;
}

.login-page .form-hint {
    font-size: 16px;
    color: #ffffff;
}

.login-page .form-hint a,
.login-page .form-hint a:visited,
.login-page .form-hint a:hover,
.login-page .form-hint a:active {
    color: inherit;
    text-decoration: none;
    pointer-events: none;
    cursor: default;
}

.form-group:last-child {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 400px;
    width: calc(100% - 40px);
}

.form-input {
    width: 100%;
    padding: 18px 20px;
    border: none;
    border-radius: 25px;
    font-size: 18px;
    background: rgba(255, 255, 255, 0.95);
    color: #999;
    text-align: center;
    outline: none;
    transition: all 0.25s ease;
}

.form-input:focus {
    background: rgba(255, 255, 255, 1);
    color: #333;
    box-shadow: 0 0 15px rgba(135, 206, 235, 0.5);
}

.btn-submit {
    width: 100%;
    padding: 18px 20px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 28px;
    font-size: 18px;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffffff;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.25s ease;
    margin-top: 20px;
}

.btn-submit:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.16);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: linear-gradient(135deg, #002a58 0%, #002a58 100%);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 90%;
    margin: 0 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-content p {
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.5;
}

.btn-close {
    padding: 12px 40px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    background: #fff;
    color: #002a58;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-close:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.3);
}

/* Page Title */
.page-title {
    text-align: center;
    margin: 20px 0 30px;
}

.page-title h2 {
    font-size: 32px;
    font-weight: bold;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Menu Grid */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 30px;
    margin: 20px 0;
}


.menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 10px;
    text-decoration: none;
    transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}

.menu-item.active {
    opacity: 1;
}

.menu-item.inactive {
    opacity: 0.4;
    pointer-events: none;
}

.menu-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #002a58 0%, #002a58 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    padding: 15px;
}

.menu-item.inactive .menu-icon {
    background: #ccc;
}

.menu-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.menu-label {
    font-size: 12px;
    font-weight: bold;
    color: #002a58;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.2;
}

.menu-item.active:hover .menu-icon {
    transform: scale(1.06) translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 42, 88, 0.28);
}

/* QR Code Page */
.qr-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
}

.qr-card {
    position: relative;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 32px;
    padding: 36px 28px 32px;
    text-align: center;
    color: #002a58;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.8);
    animation: cardFloat 6s ease-in-out infinite;
}

/* My Score (scoped) */
.myscore-page .qr-container {
    padding: 10px 0 0;
}

.myscore-page .qr-card.score-card {
    padding: 22px;
    max-width: 420px;
    border-radius: 40px;
}

.myscore-page .score-panel {
    background: #002a58;
    color: #ffffff;
    border-radius: 30px;
    padding: 24px 18px 20px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
}

.myscore-page .score-panel-title {
    font-size: 34px;
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.myscore-page .score-panel-pill {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.myscore-page .score-panel-value {
    margin-top: 10px;
    font-size: 86px;
    font-weight: 900;
    line-height: 1;
}

.myscore-page .score-unit {
    display: inline-block;
    margin-left: 10px;
    font-size: 16px;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: 0.9;
    vertical-align: baseline;
}

.myscore-page .score-panel-sub {
    margin-top: 6px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    opacity: 0.85;
}

.myscore-page .score-split {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    overflow: hidden;
    border-radius: 26px;
    border: 1px solid rgba(227, 230, 239, 0.9);
    background: rgba(255, 255, 255, 0.98);
}

.myscore-page .score-split-item {
    padding: 14px 10px 12px;
}

.myscore-page .score-split-item + .score-split-item {
    border-left: 1px solid rgba(227, 230, 239, 0.9);
}

.myscore-page .score-split-value {
    font-size: 36px;
    font-weight: 900;
    color: #002a58;
    line-height: 1;
}

.myscore-page .score-split-label {
    margin-top: 8px;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(0, 42, 88, 0.7);
}

.myscore-page .redeem-btn-container {
    text-align: center;
    margin-top: 14px;
}

.user-info {
    width: 100%;
    text-align: left;
    margin-bottom: 18px;
}

.info-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(227, 230, 239, 0.9);
}

.info-line:last-child {
    border-bottom: none;
}

.info-label {
    color: #002a58;
    font-weight: 700;
}

.info-value {
    color: #002a58;
    font-weight: 600;
    text-align: right;
    word-break: break-word;
}

.qr-title {
    font-size: 30px;
    font-weight: 700;
    color: #002a58;
    margin-bottom: 26px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.qr-code {
    margin: 30px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

.qr-image {
    max-width: 300px;
    width: 100%;
    height: auto;
    border: 3px solid #002a58;
    border-radius: 10px;
    padding: 10px;
    background: #fff;
}

.no-qr {
    font-size: 16px;
    color: #999;
    padding: 50px 20px;
}

.agency-id {
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px solid #e3e6ef;
}

.agency-id p {
    font-size: 14px;
    color: #777;
    margin: 4px 0;
}

.id-value {
    font-size: 22px;
    font-weight: 700;
    color: #002a58;
    letter-spacing: 1.5px;
}

/* Button Containers */
.logout-btn-container,
.back-btn-container {
    text-align: center;
    margin-top: 30px;
    padding-bottom: 20px;
}

/* Agenda Page */
.agenda-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 20px 0;
    overflow-y: auto;
    gap: 20px;
}

.agenda-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.agenda-image:hover {
    transform: scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

/* Quiz Page */
.quiz-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
}

.quiz-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 32px;
    padding: 36px 28px 32px;
    text-align: center;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.quiz-question {
    margin-bottom: 30px;
}

.question-number {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

.quiz-question h3 {
    font-size: 20px;
    color: #002a58;
    font-weight: 600;
    line-height: 1.8;
    margin-bottom: 25px;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.quiz-option {
    background: rgba(255, 255, 255, 0.6);
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    padding: 18px 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.quiz-option:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: #002a58;
    transform: translateX(5px);
}

.quiz-option.selected {
    background: rgba(0, 42, 88, 0.10);
    border-color: #002a58;
}

.quiz-option.correct {
    background: rgba(34, 197, 94, 0.15);
    border-color: #22c55e;
}

.quiz-option.incorrect {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
}

.quiz-option input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.quiz-option label {
    flex: 1;
    text-align: left;
    font-size: 16px;
    color: #002a58;
    cursor: pointer;
    font-weight: 500;
}

.quiz-navigation {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.btn-quiz {
    padding: 15px 50px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 28px;
    font-size: 16px;
    font-weight: bold;
    background: rgba(0, 42, 88, 0.9);
    backdrop-filter: blur(8px);
    color: #ffffff;
    text-decoration: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.25s ease;
}

.btn-quiz:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(0, 42, 88, 0.4);
    background: rgba(0, 42, 88, 1);
}

.quiz-result {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.result-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 32px;
    padding: 50px 40px;
    text-align: center;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.result-card h3 {
    font-size: 32px;
    color: #002a58;
    margin-bottom: 20px;
    font-weight: 700;
}

.result-message {
    font-size: 18px;
    color: #002a58;
    margin-bottom: 30px;
    font-weight: 500;
}

.result-score {
    font-size: 24px;
    color: #002a58;
    margin-bottom: 30px;
    font-weight: 600;
}

.result-score span {
    font-size: 36px;
    color: #002a58;
    font-weight: 700;
}

/* Image Modal */
.image-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    justify-content: center;
    align-items: center;
    animation: modalFadeIn 0.3s ease;
}

.modal-image {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 50px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: #87CEEB;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.btn-logout,
.btn-back {
    display: inline-block;
    padding: 15px 60px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 28px;
    font-size: 16px;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffffff;
    text-decoration: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.25s ease;
}

.btn-logout:hover,
.btn-back:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.16);
}

/* E-Stamp (layout 4-3-2) */
.stamp-card-title .title {
    font-weight: 900;
    letter-spacing: 3px;
    font-size: 40px;
}

.stamp-card-title .subtitle {
    margin-top: 8px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.8px;
    opacity: 0.8;
}

.stamp-layout {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.stamp-row {
    display: grid;
    gap: 16px;
    justify-content: center;
    margin-top: 10px;
}

/* 6 booths: 2 rows of 3 */
.stamp-row {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
}

.stamp-item {
    width: 100px;
    height: 100px;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform 0.2s;
}

.stamp-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    filter: grayscale(100%) brightness(1.3);
    opacity: 0.25;
    transition: all 0.4s ease;
    border-radius: 50%;
}

.stamp-icon.is-scanned {
    filter: none;
    opacity: 1;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 100, 255, 0.6);
}

.stamp-toast {
    margin: 12px auto 0;
    padding: 14px 22px;
    border-radius: 999px;
    display: inline-block;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 0.8px;
    color: #002a58;
    background: rgba(0, 42, 88, 0.08);
    border: 1px solid rgba(0, 42, 88, 0.14);
}

.stamp-toast-error {
    color: #fff;
    background: rgba(220, 53, 69, 0.9);
    border: 1px solid rgba(220, 53, 69, 1);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

@media (max-width: 390px) {
    .stamp-item { width: 85px; height: 85px; }
    .stamp-row { gap: 10px; margin-bottom: 10px; }
}

/* E-Stamp Scan Button (icon) */
.stamp-actions {
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-scan-icon {
    width: 200px;
    height: 200px;
    padding: 0;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border-radius: 40px;
}

.btn-scan-icon img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    display: block;
}

@media (max-width: 390px) {
    .btn-scan-icon { width: 180px; height: 180px; border-radius: 36px; }
    .btn-scan-icon img { width: 90px; height: 90px; }
}

/* Animations */
@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

@keyframes cardFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

/* Responsive Design */
@media (max-width: 400px) {
    .container {
        padding: 15px;
    }
    
    .brand-name {
        font-size: 24px;
    }
    
    .event-name {
        font-size: 30px;
    }
    
    .menu-grid {
        gap: 10px;
        padding: 10px;
    }
    
    .menu-icon {
        width: 60px;
        height: 60px;
    }
    
    .menu-label {
        font-size: 10px;
    }
    
    .qr-card {
        padding: 30px 20px;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 600px;
    }
    
    .menu-grid {
        gap: 20px;
        padding: 30px;
    }
    
    .menu-icon {
        width: 100px;
        height: 100px;
    }
    
    .menu-label {
        font-size: 14px;
    }
}

@media (min-width: 1025px) {
    .container {
        max-width: 900px;
        padding: 40px;
    }
    
    .header {
        margin-bottom: 50px;
        padding-top: 40px;
    }
    
    .logo {
        width: 80%;
        max-width: 80%;
        margin-bottom: 20px;
    }
    
    .brand-name {
        font-size: 36px;
        margin-bottom: 20px;
    }
    
    .brand-icon {
        font-size: 32px;
    }
    
    .event-subtitle {
        font-size: 18px;
    }
    
    .event-name {
        font-size: 48px;
        letter-spacing: 3px;
    }
    
    .page-title h2 {
        font-size: 42px;
        margin-bottom: 10px;
    }
    
    .menu-grid {
        gap: 30px;
        padding: 40px;
        border-radius: 40px;
        max-width: 800px;
        margin: 30px auto;
    }
    
    .menu-icon {
        width: 120px;
        height: 120px;
    }
    
    .menu-label {
        font-size: 16px;
        margin-top: 5px;
    }
    
    .login-form {
        max-width: 500px;
    }
    
    .form-input {
        padding: 22px 24px;
        font-size: 18px;
        border-radius: 30px;
    }
    
    .btn-submit {
        padding: 22px 24px;
        font-size: 20px;
        border-radius: 32px;
    }
    
    .form-group:last-child {
        max-width: 500px;
    }
    
    .qr-card {
        max-width: 500px;
        padding: 50px 40px;
        border-radius: 40px;
    }
    
    .qr-title {
        font-size: 36px;
        margin-bottom: 35px;
    }
    
    .qr-image {
        max-width: 350px;
        border-width: 4px;
        border-radius: 15px;
        padding: 15px;
    }
    
    .agency-id p {
        font-size: 16px;
    }
    
    .id-value {
        font-size: 26px;
    }
    
    .btn-logout,
    .btn-back {
        padding: 18px 80px;
        font-size: 18px;
        border-radius: 32px;
    }
    
    .agenda-image {
        max-width: 900px;
        border-radius: 30px;
    }
    
    .modal-image {
        max-width: 90%;
        max-height: 90%;
    }
}
