body {
    margin: 0; /* ลบระยะขอบเริ่มต้น */
    padding: 0; /* ลบระยะห่างเริ่มต้น */
    font-family: 'Arial', sans-serif;
    font-size: 16px;
    line-height: 1.6; 
    background: linear-gradient(135deg, #c3e1ff, #5b8bd1); 
    color: #333; /* สีข้อความ */
    transition: background 0.5s ease, color 0.5s ease; /* การเปลี่ยนแปลงแบบนุ่มนวล */
    min-height: 100vh; /* ความสูงขั้นต่ำเต็มหน้าจอ */
}

body.dark-mode {
    background: linear-gradient(135deg, #121212, #1e1e1e);
    color: #ffffff;
}

/* Container */
.container {
    padding: 2rem;
    text-align: center;
    max-width: 800px;
    margin: auto;
    background-color: rgba(240, 244, 250, 0.95);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: all 0.5s ease;
    animation: fadeInUp 0.8s ease-in-out;
    backdrop-filter: blur(10px);
}

.container.dark-mode {
    background-color: rgba(30, 30, 30, 0.95);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

/* Typography */
h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: #0b3d91;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    transition: color 0.5s ease;
}

.dark-mode h1 {
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Typography - University Name (h4) */
h4 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: #1e3a8a;
    /* สีน้ำเงินเข้ม */
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.15);
    transition: color 0.5s ease;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 15px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(30, 58, 138, 0.1);
    letter-spacing: 0.5px;
}
.dark-mode h4 {
    color: #60a5fa;
    /* สีฟ้าสว่าง */
    text-shadow: 0 0 10px rgba(96, 165, 250, 0.5);
    background: rgba(106, 112, 106, 0.3);
    border: 1px solid rgba(96, 165, 250, 0.2);
}

/* Typography - 3D Model Viewer Title (h5) */
h5 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1e3a8a;
    /* สีน้ำเงินเข้ม */
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.15);
    transition: color 0.5s ease;
    margin: 1.5rem 0;
    padding: 0.5rem 1.5rem;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    display: inline-block;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(30, 64, 175, 0.1);
    letter-spacing: 0.3px;
}

.dark-mode h5 {
    color: #93c5fd;
    /* สีฟ้าอ่อน */
    background: rgba(30, 64, 175, 0.25);
    text-shadow: 0 0 8px rgba(147, 197, 253, 0.5);
    border: 1px solid rgba(147, 197, 253, 0.2);
}

/* Responsive Styles for Headings */
@media (max-width: 768px) {
    h4 {
        font-size: 1.5rem;
        padding: 0.4rem 0.8rem;
    }

    h5 {
        font-size: 1.2rem;
        padding: 0.4rem 1.2rem;
    }
}

@media (max-width: 480px) {
    h4 {
        font-size: 1.3rem;
        padding: 0.3rem 0.6rem;
    }

    h5 {
        font-size: 1.1rem;
        padding: 0.3rem 1rem;
    }
}

/* Model Viewer */
model-viewer {
    width: 100%;
    max-width: 800px;
    height: 600px;
    margin: 2rem auto 1rem;
    background-color: rgba(224, 230, 237, 0.5);
    border-radius: 20px;
    border: 1px solid rgba(170, 170, 170, 0.3);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}
model-viewer.dark-mode {
    background-color: rgba(46, 46, 46, 0.5);
    border: 1px solid rgba(68, 68, 68, 0.3);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

model-viewer:hover {
    transform: scale(1.01);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

/* Loading Animation */
#loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.loading-animation {
    width: 50px;
    height: 50px;
    border: 4px solid #0b3d91;
    border-top: 4px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.dark-mode .loading-animation {
    border-color: #fff;
    border-top-color: transparent;
}

#loading p {
    margin: 0;
    font-weight: 500;
    color: #333;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.dark-mode #loading p {
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

/* Button Styles */
.btn-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 2rem auto;
    flex-wrap: wrap;
    padding: 0 1.5rem;
}

.btn {
    min-width: 160px;
    height: 48px;
    padding: 0 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 24px;
    border: none;
    color: white;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

#arButton {
    background-image: linear-gradient(to right, #0b3d91, #1a5fb4);
}

#arButton:hover {
    background-image: linear-gradient(to right, #062e6f, #134a8e);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* Dark Mode Switch */
.form-check {
    display: flex;
    align-items: center;
    background: rgb(255, 253, 253);
    padding: 8px 16px;
    border-radius: 24px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
    margin: 0;
    gap: 12px;
}

.dark-mode .form-check {
    background: rgb(0, 0, 0);
    text-shadow: 0 0 10px rgb(255, 255, 255);
}

.dark-mode-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.dark-mode-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: all 0.4s ease;
    border-radius: 34px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider:before {
    position: absolute;
    content: "☀️";
    font-size: 18px;
    text-align: center;
    line-height: 26px;
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: all 0.4s ease;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
    background-color: #0b3d91;
}

input:checked+.slider:before {
    content: "🌙";
    transform: translateX(26px);
}

/* Progress Bar */
#progress-container {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.progress {
        height: 20px;
            border-radius: 10px;
            /* ปรับ background ให้โปร่งใสมากขึ้น */
            background-color: rgba(209, 217, 230, 0.1);
            overflow: hidden;
            backdrop-filter: blur(5px);
            border: 1px solid rgba(255, 255, 255, 0.1);
        }


.progress-bar {
    background-image: linear-gradient(to right, #0b3d91, #1a5fb4);
    transition: width 0.4s ease;
    border-radius: 10px;
}

.dark-mode .progress-bar {
    background-image: linear-gradient(to right, #1e90ff, #4169e1);
}

.progress-text {
    margin-top: 8px;
    font-weight: 600;
    color: #333;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.dark-mode .progress-text {
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

/* Error Message */
#error-message {
    background-color: rgba(220, 53, 69, 0.95);
    color: white;
    padding: 1rem;
    border-radius: 10px;
    margin-top: 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transform: translateY(-10px);
    opacity: 0;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

#error-message.show {
    transform: translateY(0);
    opacity: 1;
}

/* Instructions Section */
.alert-info {
    background-color: rgba(227, 242, 253, 0.8);
    border: none;
    border-radius: 15px;
    padding: 1.5rem;
    margin-top: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.dark-mode .alert-info {
    background-color: rgba(26, 35, 126, 0.8);
    color: #fff;
}

/* Toggle Buttons */
.toggle-button {
    background-color: #0b3d91;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 25px;
    cursor: pointer;
    margin: 5px 0;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.toggle-button:hover {
    background-color: #062e6f;
    transform: translateY(-2px);
}

.toggle-button.active::after {
    content: '▲';
}

.toggle-button::after {
    content: '▼';
    margin-left: 8px;
    font-size: 0.8rem;
}

/* Collapsible Content */
.collapsible {
    display: none;
    list-style-type: none;
    padding-left: 20px;
    margin: 10px 0;
    transition: all 0.3s ease;
}

.collapsible.active {
    display: block;
    animation: slideDown 0.3s ease-out;
}

/* Footer */
footer {
    text-align: center;
    padding: 1rem;
    margin-top: 2rem;
    color: #333;
}

.dark-mode footer {
    color: #fff;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        margin: 1rem;
    }

    model-viewer {
        height: 500px;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 1.8rem;
    }

    model-viewer {
        height: 400px;
    }

    .btn-container {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        max-width: 300px;
    }

    .form-check {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }

    model-viewer {
        height: 300px;
    }

    .container {
        margin: 0.5rem;
        padding: 0.8rem;
    }

    .btn {
        font-size: 0.9rem;
        height: 45px;
        min-width: 140px;
    }

    .form-check {
        padding: 6px 12px;
    }

    .alert-info {
        padding: 1rem;
    }
}

/* High Contrast & Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

@media (forced-colors: active) {
    .btn {
        border: 2px solid currentColor;
    }
}