/* --- Fluid Typography & Premium Styling --- */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #64748b;
    --accent-color: #f59e0b;
    --glass-bg: rgba(255, 255, 255, 0.92);
    --glass-border: rgba(255, 255, 255, 0.45);
    --shadow-premium: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

html {
    overflow-y: scroll !important;
}

body.modal-open {
    padding-right: 0 !important;
}

body {
    font-family: 'Kanit', 'Outfit', sans-serif;
    background-color: #f8fafc;
    color: #0f172a;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Outfit', 'Kanit', sans-serif;
    font-weight: 700;
}

.display-4 {
    font-size: clamp(2.25rem, 6vw, 4rem);
    font-weight: 800 !important;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    box-shadow: var(--shadow-premium);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

@media (min-width: 992.02px) {
    .glass-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.3);
    }
}

#topbar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(15px) saturate(180%);
    -webkit-backdrop-filter: blur(15px) saturate(180%);
    min-height: 56px;
    font-size: 0.95rem;
    color: #1e293b !important;
    z-index: 1050;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: none;
}

#topbar i {
    font-size: 1.3rem;
    color: #0d6efd;
}

#topbar span {
    color: #1e293b !important;
    font-weight: 600;
    text-decoration: none !important;
}

#topbar a {
    color: #1e293b !important;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(13, 110, 253, 0.05);
    padding: 8px 16px;
    border-radius: 12px;
    text-decoration: none !important;
}

#topbar a:hover {
    background: rgba(13, 110, 253, 0.1);
    transform: translateY(-2px);
    text-decoration: none;
    color: #0d6efd !important;
}

/* Feature Item Redesign */
.feat-item {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    padding: 20px 24px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    max-width: 500px;
}

.feat-item:hover {
    transform: translateX(10px);
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.feat-item i {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color) !important;
    color: #fff !important;
    border-radius: 12px;
    font-size: 1.2rem;
    margin-right: 20px;
    box-shadow: 0 8px 15px rgba(13, 110, 253, 0.2);
}

.feat-item span {
    font-weight: 500;
    color: #334155;
    font-size: 1.05rem;
}

body {
    background-color: #f8fafc;
    background-image:
        radial-gradient(at 0% 0%, rgba(13, 110, 253, 0.08) 0, transparent 50%),
        radial-gradient(at 50% 0%, rgba(3, 78, 162, 0.05) 0, transparent 50%),
        radial-gradient(at 100% 0%, rgba(13, 110, 253, 0.08) 0, transparent 50%);
    background-attachment: fixed;
    font-family: 'Sarabun', sans-serif;
    color: #1e293b;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%239C92AC' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    z-index: -1;
    pointer-events: none;
}

/* Forms */
.form-control,
.form-select {
    border-radius: 14px;
    padding: 12px 18px;
    border: 1px solid #e2e8f0;
    font-size: 0.95rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    height: auto;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.15);
    background-color: #fff;
}

/* Input Group Modernization */
.input-group {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.input-group:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.12), 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.input-group .input-group-text {
    background-color: transparent !important;
    border: none !important;
    padding-left: 20px;
    color: #64748b;
    font-size: 1.1rem;
}

.input-group .form-control,
.input-group .form-select {
    border: none !important;
    padding: 14px 16px 14px 8px !important;
    box-shadow: none !important;
    background-color: transparent !important;
    font-weight: 400;
}

.input-group .form-select {
    cursor: pointer;
}

.input-group .form-control:focus,
.input-group .form-select:focus {
    background-color: transparent;
}


.form-control::placeholder {
    color: #94a3b8 !important;
    opacity: 0.4 !important;
}

.form-control::-webkit-input-placeholder {
    color: #94a3b8 !important;
    opacity: 0.4 !important;
}

.form-control::-moz-placeholder {
    color: #94a3b8 !important;
    opacity: 0.4 !important;
}

.form-control:-ms-input-placeholder {
    color: #94a3b8 !important;
    opacity: 0.4 !important;
}

.btn-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #034ea2 100%);
    border: none;
    padding: 12px 30px;
    border-radius: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 10px 20px -5px rgba(13, 110, 253, 0.3);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 30px -5px rgba(13, 110, 253, 0.4);
    background: linear-gradient(135deg, #0b5ed7 0%, #023d80 100%);
}

.btn-primary:active {
    transform: translateY(-1px) scale(0.98);
}

.btn-primary::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.btn-primary:hover::after {
    left: 100%;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

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

.fade-in-down {
    opacity: 0;
    animation: fadeInDown 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Landing Page Layout */
body {
    background-color: #0f172a !important;
    background-image: url('../img/bg_1900.png') !important;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(165deg, rgba(15, 23, 42, 0.85) 0%, rgba(13, 110, 253, 0.5) 100%);
    z-index: -1;
}

#main {
    min-height: 100vh;
    padding: 100px 0 60px;
    display: flex;
    align-items: center;
}

.info-section {
    color: #ffffff;
}

.info-section h1 {
    color: #ffffff !important;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.feat-item {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 16px 20px;
    transition: all 0.4s ease;
}

.feat-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(10px) scale(1.02);
}

.feat-item i {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feat-item span {
    color: #ffffff !important;
    font-size: 1.05rem;
    font-weight: 500;
}

/* Footer Styling */
#footer {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    padding: 30px 0;
    margin-top: auto;
    width: 100%;
    z-index: 1000;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

#footer::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(13, 110, 253, 0.5), transparent);
}

#footer .copyright {
    text-align: center;
    letter-spacing: 0.3px;
}

#footer strong {
    color: #ffffff;
    font-weight: 600;
    margin-right: 4px;
}

#footer a {
    color: #60a5fa;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    padding-bottom: 2px;
    border-bottom: 1px solid transparent;
}

#footer a:hover {
    color: #ffffff;
    border-bottom-color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

#footer .developer-credit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#footer i.fa-heart {
    animation: pulse-heart 1.5s infinite;
}

@keyframes pulse-heart {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* Back to Top */
.back-to-top {
    position: fixed;
    visibility: hidden;
    opacity: 0;
    right: 15px;
    bottom: 80px;
    /* Elevated to avoid footer */
    z-index: 996;
    background: var(--primary-color);
    width: 40px;
    height: 40px;
    border-radius: 50px;
    transition: all 0.4s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 110, 253, 0.3);
}

.back-to-top i {
    font-size: 24px;
    color: #fff;
    line-height: 0;
}

.back-to-top:hover {
    background: #0b5ed7;
    color: #fff;
    transform: translateY(-5px);
}

.back-to-top.active {
    visibility: visible;
    opacity: 1;
}

/* Tablet & Mobile Adjustments */
/* Tablet (iPad/Surface) Fixes */
@media (max-width: 1199.98px) {
    .display-4 {
        font-size: 3rem;
    }
}

@media (max-width: 991.98px) {
    #main {
        flex-direction: column;
        padding-top: 100px;
        padding-bottom: 120px;
        /* Space for footer */
        text-align: center;
    }

    .info-section {
        margin-bottom: 4rem;
        width: 100%;
    }

    .info-section .d-flex {
        justify-content: center;
    }

    .feat-item {
        max-width: 450px;
        margin: 0 auto;
    }

    #footer {
        position: relative;
        /* Unfix on small screens IF needed, but keeping fixed for now to maintain consistency */
    }
}

/* Mobile Fixes */
@media (max-width: 575.98px) {
    .display-4 {
        font-size: 2rem;
    }

    .glass-card {
        padding: 40px 24px !important;
        margin: 0 12px;
        border-radius: 24px;
    }

    #topbar span {
        display: none;
    }

    #topbar .icofont-university {
        font-size: 1.2rem;
    }

    .feat-item {
        padding: 12px 16px;
        font-size: 0.95rem;
    }

    .feat-item i {
        font-size: 1.2rem;
    }

    #footer {
        padding: 15px 10px;
        font-size: 11px;
    }
}

/* Login Header Icon Effect */
.login-header-icon {
    background: rgba(13, 110, 253, 0.08);
    width: 80px;
    height: 80px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-bottom: 1.5rem;
    position: relative;
    border: 1px solid rgba(13, 110, 253, 0.1);
    transition: all 0.5s ease;
}

.login-header-icon::after {
    content: "";
    position: absolute;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: 1px dashed rgba(13, 110, 253, 0.3);
    animation: rotate-dashed 15s linear infinite;
}

.login-header-icon i {
    z-index: 2;
    transition: all 0.5s ease;
}

.login-header-icon:hover {
    background: rgba(13, 110, 253, 0.15);
    transform: scale(1.05);
}

.login-header-icon:hover i {
    transform: scale(1.1);
}

@keyframes rotate-dashed {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* --- PDPA & Cookie Banner Styles --- */
body.modal-open {
    padding-right: 0 !important;
}

body.modal-open #topbar {
    padding-right: 0 !important;
}

.close-modal-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    outline: none !important;
}

.close-modal-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

.cookie-banner {
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.08) !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #ffffff;
    border-top: 1px solid #eee;
    display: none;
    opacity: 0;
    transform: translateY(100%);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-banner.show-banner {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* --- Sleek Top Progress Bar Preloader --- */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 30%;
    height: 4px;
    z-index: 1000000;
    background: linear-gradient(to right, #0d6efd, #60a5fa);
    box-shadow: 0 0 10px rgba(13, 110, 253, 0.5);
    transition: width 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}