/* --- Modern & Professional Theme --- */

:root {
    --primary-blue: #0A2B4C; /* Deep Navy Blue */
    --accent-blue: #007BFF; /* Bright Blue for links/accents */
    --light-gray-bg: #f8f9fa;
    --text-dark: #212529;
    --text-light: #6c757d;
    --card-border: #e9ecef;
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.07);
    --border-radius: 0.5rem; /* 8px */
    --font-family: 'IBM Plex Sans Thai', sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: #ffffff; /* Clean white background */
    color: var(--text-dark);
}

/* --- Header & Navigation --- */
.site-header {
    background-color: #fff;
    border-bottom: 1px solid #dee2e6;
}

.cia-logo {
    height: 45px;
    transition: transform 0.3s ease;
}

    .cia-logo:hover {
        transform: scale(1.05);
    }

.nav-link {
    color: var(--text-light);
    font-weight: 500;
    transition: color 0.3s ease;
}

    .nav-link:hover, .nav-link:focus {
        color: var(--primary-blue);
    }

    .nav-link i {
        margin-right: 0.25rem;
    }

/* --- Hero Section --- */
.hero-section {
    background: linear-gradient(45deg, #064d93, #0096FF);
    color: #fff;
    padding: 4rem 0;
    text-align: center;
}

    .hero-section h1 {
        font-weight: 700;
        font-size: 2.5rem;
        letter-spacing: 1px;
    }

    .hero-section p {
        font-size: 1.2rem;
        opacity: 0.9;
        font-weight: 300;
    }

/* --- Main Content & Application Cards --- */
.content-section {
    padding: 3rem 0;
}

.application-grid {
    display: grid;
    grid-template-columns: 1fr; /* Mobile First: 1 column */
    gap: 2rem;
}

/* Desktop layout */
@media (min-width: 992px) {
    .application-grid {
        grid-template-columns: 1fr 1fr; /* 2 columns on large screens */
    }
}

.application-card {
    background-color: #fff;
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Important for border-top effect */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

    .application-card:hover {
        transform: translateY(-5px);
    }

/* Colored top border to distinguish cards */
.card-tbs {
    border-top: 4px solid var(--accent-blue);
}

.card-uc {
    border-top: 4px solid #28a745;
}
/* Green for UC */

.card-body {
    padding: 1.5rem 2rem;
    flex-grow: 1;
}

.card-title {
    font-weight: 600;
    color: var(--primary-blue);
    margin-bottom: 1.5rem;
}

.instructions-list {
    list-style: none;
    padding: 0;
}

    .instructions-list li {
        display: flex;
        align-items: flex-start;
        margin-bottom: 1.25rem;
    }

.instruction-icon {
    font-size: 1.5rem;
    color: var(--accent-blue);
    margin-right: 1rem;
    margin-top: 0.2rem;
}

.instruction-text h6 {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.instruction-text p {
    color: var(--text-light);
    margin-bottom: 0;
    font-size: 0.95rem;
}

.deadline-wrapper {
    text-align: center;
    margin-top: 2rem;
    padding: 0.75rem;
    background-color: var(--light-gray-bg);
    border-radius: 0.375rem;
}

.deadline-text {
    font-weight: 600;
    color: #dc3545;
}

.card-footer {
    background-color: var(--light-gray-bg);
    padding: 1.5rem;
    text-align: center;
}

/* --- Buttons --- */
.btn-custom {
    padding: 0.75rem 2rem;
    font-weight: 600;
    border-radius: 50px; /* Pill shape */
    transition: all 0.3s ease;
    border: none;
}

.btn-Scholarship_Ex {
    background: linear-gradient(45deg, #064d93, #0096FF);
    color: white;
}

.btn-Scholarship {
    background: linear-gradient(45deg, #28a745, #218838);
    color: white;
}

.btn-download {
    background: linear-gradient(45deg, var(--accent-blue), #0056b3);
    color: white;
}

.btn-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-custom:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}


/* --- Footer --- */
.site-footer-bottom {
    background-color: var(--primary-blue);
    color: #fff;
    padding: 2.0rem 0;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.footer-info {
    opacity: 0.8;
}

.footer-contact a {
    color: white;
    font-size: 1rem;
    margin-left: 1rem;
    opacity: 0.8;
    transition: opacity 0.3s, transform 0.3s;
}

    .footer-contact a:hover {
        opacity: 1;
        transform: scale(1.1);
    }

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-contact {
        margin-top: 1rem;
    }

    .hero-section h1 {
        font-size: 2rem;
    }

    .hero-section p {
        font-size: 1rem;
    }
}

/* --- Loading Overlay Spinner Styles --- */
.loading-overlay {
    /* ทำให้ div ลอยทับเต็มหน้าจอ */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* พื้นหลังสีดำโปร่งแสง */
    background-color: rgba(0, 0, 0, 0.7);
    /* จัดให้ spinner และข้อความอยู่ตรงกลางจอ */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* ทำให้มันอยู่ชั้นบนสุดเสมอ */
    z-index: 9999;
    /* เพิ่ม transition เพื่อให้การแสดงผลนุ่มนวล */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

    /* state ตอนที่แสดง popup */
    .loading-overlay.show {
        opacity: 1;
        visibility: visible;
    }


    .loading-overlay p {
        color: white;
        text-align: center;
        font-size: 20px;
        margin-top: 1rem;
    }

/* --- Spinner Animation --- */
.spinner {
    width: 60px;
    height: 60px;
    position: relative;
}

.double-bounce1, .double-bounce2 {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #fff;
    opacity: 0.6;
    position: absolute;
    top: 0;
    left: 0;
    /* เรียกใช้ animation ชื่อ sk-bounce */
    animation: sk-bounce 2.0s infinite ease-in-out;
}

.double-bounce2 {
    /* ทำให้วงที่สองเริ่มช้ากว่าวงแรก */
    animation-delay: -1.0s;
}

/* ส่วนที่กำหนดท่าทางการเคลื่อนไหว (animation) */
@keyframes sk-bounce {
    0%, 100% {
        transform: scale(0.0);
    }

    50% {
        transform: scale(1.0);
    }
}
/* --- Stepper / Progress Bar --- */
.stepper-wrapper {
    background-color: var(--light-gray-bg);
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--card-border);
}

.stepper {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

.stepper-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
    color: var(--text-light);
}

.stepper-marker {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #fff;
    border: 2px solid #ced4da;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    transition: all 0.3s ease;
    z-index: 2;
}

.stepper-label {
    margin-top: 0.5rem;
    font-size: 0.8rem; /* Responsive font size for smaller screens */
    text-align: center;
}

@media (min-width: 576px) {
    .stepper-label {
        font-size: 0.9rem;
    }
}


/* Connector line */
.stepper-item:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 50%;
    width: 100%;
    height: 2px;
    background-color: #ced4da;
    z-index: 1;
    transform: translateY(-50%);
}

/* Active State */
.stepper-item.active .stepper-marker {
    background-color: var(--accent-blue);
    color: #fff;
    border-color: var(--accent-blue);
}

.stepper-item.active {
    color: var(--primary-blue);
    font-weight: 600;
}


/* --- Consent Form Page --- */
.consent-container {
    max-width: 900px;
    margin: 2rem auto;
    background-color: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.consent-header {
    text-align: center;
    padding: 2rem;
    background-color: var(--light-gray-bg);
    border-bottom: 1px solid var(--card-border);
}

    .consent-header h3 {
        color: var(--primary-blue);
        font-weight: 600;
        margin-bottom: 0.25rem;
    }

    .consent-header p {
        color: var(--text-light);
        margin: 0;
    }

.consent-text-area {
    padding: 1.5rem 2rem;
    max-height: 500px;
    overflow-y: auto;
    color: #495057;
}

    /* Custom Scrollbar */
    .consent-text-area::-webkit-scrollbar {
        width: 8px;
    }

    .consent-text-area::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    .consent-text-area::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 4px;
    }

        .consent-text-area::-webkit-scrollbar-thumb:hover {
            background: #aaa;
        }


    .consent-text-area ol.consent-list > li {
        margin-bottom: 2rem;
    }

    .consent-text-area ul {
        list-style-type: disc;
        padding-left: 20px;
        margin-top: 0.5rem;
    }

        .consent-text-area ul li {
            margin-bottom: 0.5rem;
        }

    .consent-text-area address {
        font-style: normal;
        background-color: #f8f9fa;
        padding: 1rem;
        border-radius: .25rem;
        border: 1px solid #dee2e6;
    }

.confirmation-section {
    margin-top: 2rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 0.375rem;
}

.consent-actions {
    padding: 2rem;
    background-color: #fff;
    border-top: 1px solid var(--card-border);
    text-align: center;
}

.form-check {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.form-check-input {
    width: 1.5em;
    height: 1.5em;
    margin-right: 0.75rem;
    cursor: pointer;
}

/* --- Application Form Styles --- */

.form-main-title {
    text-align: center;
    color: var(--primary-blue);
    margin-bottom: 2rem;
    font-weight: 600;
}

.form-section {
    background-color: #fff;
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    padding: 2rem;
}

.form-section-title {
    color: var(--primary-blue);
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.required {
    color: #dc3545;
    font-weight: 600;
}

.form-text-description {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 0.5rem;
}

.form-actions {
    background-color: var(--light-gray-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
}

/* Modal Review Styles */
#confirmation-details h6 {
    color: var(--primary-blue);
    font-weight: 600;
    margin-top: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

#confirmation-details p {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

    #confirmation-details p strong {
        color: #333;
    }

#confirmation-details span {
    color: #555;
    text-align: right;
}
/* --- Application Form Styles --- */

.form-main-title {
    text-align: center;
    color: var(--primary-blue);
    margin-bottom: 2.5rem;
    font-weight: 600;
}

.form-section {
    background-color: #fff;
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    padding: 1.5rem 2rem 2rem 2rem;
}

.form-section-title {
    color: var(--primary-blue);
    font-weight: 600;
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.required {
    color: #dc3545;
    font-weight: 600;
    padding-left: 2px;
}

.form-text {
    font-size: 0.85rem;
}

.form-actions {
    background-color: var(--light-gray-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
}

/* --- Stepper Completed State --- */
.stepper-item.completed .stepper-marker {
    background-color: #198754; /* Bootstrap Success Green */
    color: #fff;
    border-color: #198754;
}

.stepper-item.completed {
    color: var(--text-dark);
}

    .stepper-item.completed::after {
        background-color: #198754;
    }

/* --- Success Page Styles --- */
.success-container {
    max-width: 700px;
    margin: 2rem auto;
    padding: 3rem 2rem;
    text-align: center;
    background-color: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
}

.success-icon {
    font-size: 5rem;
    color: #198754; /* Bootstrap Success Green */
    line-height: 1;
    margin-bottom: 1.5rem;
}

.success-title {
    color: var(--primary-blue);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.success-message {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}

    .success-message .user-email {
        color: var(--primary-blue);
        font-weight: 600;
    }

.success-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

    .success-actions .btn {
        min-width: 140px;
    }
}
