/* --- Custom Colors based on White-Dark-Red Professional Theme --- */
:root {
    --kmitl-dark: #1a1410;
    --kmitl-dark-green: #1a1410;
    --kmitl-teal: #c41612;
    --kmitl-gold: #c41612;
    --kmitl-text: #1a1410;
    --kmitl-bg-light: #ffffff;
    --cs-navy: #1a1410;
    --cs-sea: #c41612;
    --cs-cyan: #8b0000;
    --cs-cream: #f5f3f1;
}

html, body {
    overflow-x: hidden;
    width: 100%;
}

body {
    position: relative;
    background-color: var(--kmitl-bg-light);
    color: var(--kmitl-text);
    font-family: 'Kanit', sans-serif;
    margin: 0;
}

body::before {
    content: "";
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(circle at 10% -10%, rgba(196, 22, 18, 0.05), transparent 35%),
        radial-gradient(circle at 95% 0%, rgba(139, 0, 0, 0.03), transparent 36%);
    z-index: -10;
    pointer-events: none;
}

h1, h2, h3, h4, h5, h6, .navbar-brand {
    font-family: 'Kanit', sans-serif;
}

/* Preserve icon fonts */
i, .fas, .fab, .far, .fal, [class^="fa-"], [class*=" fa-"] {
    font-family: "Font Awesome 6 Free" !important;
}

/* --- Navigation --- */
.cs-navbar {
    background: #ffffff;
    border-bottom: 2px solid #c41612;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 16px rgba(26, 20, 16, 0.08);
}

.brand-chip {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    background: linear-gradient(135deg, #c41612, #8b0000);
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(196, 22, 18, 0.24);
}

.logo-img {
    transition: transform 0.3s ease, filter 0.3s ease;
    filter: drop-shadow(0 2px 8px rgba(196, 22, 18, 0.15));
}

.cs-navbar .navbar-brand:hover .logo-img {
    transform: scale(1.05);
    filter: drop-shadow(0 4px 12px rgba(196, 22, 18, 0.25));
}

@media (max-width: 575.98px) {
    .logo-img {
        height: 38px !important;
    }
}

.cs-navbar .navbar-brand {
    color: #1a1410;
    letter-spacing: 0.02em;
    font-weight: 600;
}

.cs-navbar .nav-link {
    color: #1a1410;
    border-radius: 999px;
    padding: 0.5rem 0.9rem;
    font-weight: 500;
    transition: all 0.25s ease;
}

.cs-navbar .nav-link:hover,
.cs-navbar .nav-link.active {
    color: #ffffff;
    background: #c41612;
}

.cs-navbar .navbar-toggler {
    border-color: rgba(26, 20, 16, 0.1);
}

.cs-navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2826, 20, 16, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.btn-gold {
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #c41612, #8b0000);
    color: #ffffff;
    font-weight: 600;
    padding: 0.55rem 1.2rem;
    box-shadow: 0 6px 16px rgba(196, 22, 18, 0.24);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* --- Cookie Consent --- */
.cookie-consent {
    position: fixed;
    inset: auto 0 0 0;
    display: flex;
    justify-content: center;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.cookie-consent.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.cookie-consent.is-hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

.cookie-consent__card {
    width: 100%;
    max-width: none;
    background: #ffffff;
    border-top: 2px solid rgba(196, 22, 18, 0.2);
    box-shadow: 0 -12px 30px rgba(26, 20, 16, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 24px;
}

.cookie-consent__title {
    color: #1a1410;
    font-weight: 700;
    margin: 0 0 6px;
}

.cookie-consent__text {
    margin: 0;
    color: rgba(26, 20, 16, 0.72);
    font-size: 0.95rem;
}

.cookie-consent__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

@media (max-width: 767.98px) {
    .cookie-consent__card {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
        padding: 16px 18px;
    }
    .cookie-consent__actions {
        width: 100%;
        justify-content: flex-end;
    }
}

.btn-gold:hover {
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(196, 22, 18, 0.36);
}

/* --- Footer --- */
.site-footer {
    position: relative;
    overflow: hidden;
    color: #1a1410;
    background:
        linear-gradient(160deg, #f5f3f1 0%, #ffffff 55%, #faf8f6 100%);
}

.footer-glow {
    position: absolute;
    width: 440px;
    height: 440px;
    right: -110px;
    top: -210px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(196, 22, 18, 0.08) 0%, rgba(196, 22, 18, 0) 70%);
    pointer-events: none;
}

.footer-brand {
    color: #1a1410;
}

.footer-title {
    color: #c41612;
    font-weight: 600;
    margin-bottom: 0.9rem;
}

.footer-muted {
    color: rgba(26, 20, 16, 0.72);
}

.footer-links li {
    margin-bottom: 0.65rem;
    color: rgba(26, 20, 16, 0.78);
}

.footer-links a {
    color: rgba(26, 20, 16, 0.78);
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease;
    display: inline-block;
}

.footer-links a:hover {
    color: #c41612;
    transform: translateX(3px);
}

.social-pill {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #c41612;
    border-radius: 12px;
    background: rgba(196, 22, 18, 0.08);
    transition: all 0.22s ease;
}

.social-pill:hover {
    color: #ffffff;
    transform: translateY(-2px);
    background: #c41612;
}

.footer-card {
    background: linear-gradient(150deg, rgba(196, 22, 18, 0.06), rgba(139, 0, 0, 0.03));
    border: 1px solid rgba(196, 22, 18, 0.2);
    border-radius: 18px;
    padding: 1rem;
    color: #1a1410;
    box-shadow: 0 8px 20px rgba(26, 20, 16, 0.08);
}

.footer-divider {
    border-color: rgba(196, 22, 18, 0.18);
}

/* --- Motion --- */
.navbar,
.site-footer {
    animation: softRise 0.6s ease both;
}

@keyframes softRise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 991.98px) {
    .cs-navbar .nav-link {
        margin-bottom: 0.3rem;
    }

    .cs-navbar .btn-gold {
        width: 100%;
    }
}

.section-title { color: var(--kmitl-dark); }
.custom-icon-color { color: var(--kmitl-teal); }
.custom-link-color { color: var(--kmitl-teal); }
.custom-bg-teal { background-color: var(--kmitl-teal); color: #ffffff; }

/* --- Hero Section --- */
.hero-section {
    /* เปลี่ยน URL ด้านล่างเป็นรูปภาพนักศึกษาโยนหมวกจากโปรเจกต์ของคุณ */
    background-image: linear-gradient(rgba(17, 54, 49, 0.6), rgba(17, 54, 49, 0.6)), url('https://via.placeholder.com/1920x800?text=Hero+Image');
    background-size: cover;
    background-position: center;
    height: 70vh;
    min-height: 500px;
    margin-bottom: 50px;
}

.hero-dots .dot {
    height: 10px; width: 10px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    display: inline-block;
    margin: 0 4px;
    cursor: pointer;
}
.hero-dots .dot.active { background-color: #fff; width: 12px; height: 12px; }

.quick-links-container {
    position: absolute;
    bottom: 0; left: 50%;
    transform: translate(-50%, 50%);
    width: 100%;
    z-index: 10;
}

.custom-quick-links {
    max-width: 900px;
    border: 2px solid #c41612;
    background: #ffffff;
    box-shadow: 0 12px 32px rgba(26, 20, 16, 0.12);
}
.custom-quick-links a:hover { color: #c41612 !important; }

/* --- Cards --- */
.custom-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    border: 2px solid transparent;
}
.custom-card:hover {
    transform: translateY(-5px);
    border-color: #c41612;
    box-shadow: 0 16px 32px rgba(196, 22, 18, 0.16) !important;
}

/* --- Page Heroes (Global) --- */
.page-hero {
    background: linear-gradient(135deg, #1a1410 0%, #c41612 100%) !important;
    border-radius: 24px !important;
    padding: 50px 40px !important;
    color: #fff !important;
    margin-bottom: 40px !important;
    box-shadow: 0 20px 40px rgba(196, 22, 18, 0.15) !important;
    position: relative;
    overflow: hidden;
    text-align: center;
}

.page-hero::after {
    content: "";
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    right: -100px;
    top: -100px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0) 70%);
    pointer-events: none;
}

.page-hero h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 800;
    position: relative;
    z-index: 1;
    font-family: 'Kanit', sans-serif;
}

.page-hero p {
    margin: 10px 0 0;
    font-size: 1.1rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

@media (max-width: 767.98px) {
    .page-hero {
        padding: 35px 25px !important;
        border-radius: 18px !important;
    }
    .page-hero h1 { font-size: 1.8rem; }
    .page-hero p { font-size: 0.95rem; }
}

/* --- Modern Cards (Global) --- */
.modern-card {
    border: none !important;
    border-radius: 20px !important;
    background: #fff !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05) !important;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modern-card:hover {
    transform: translateY(-8px) !important;
    box-shadow: 0 20px 40px rgba(196, 22, 18, 0.12) !important;
}

.modern-card-header {
    padding: 25px 25px 15px;
}

.modern-card-body {
    padding: 0 25px 25px;
    flex: 1;
}

/* --- Faculty Cards (Solid Highlight) --- */
.faculty-page .modern-card {
    position: relative;
    background: #ffffff !important;
    border: 1px solid rgba(196, 22, 18, 0.18) !important;
    box-shadow: 0 18px 44px rgba(26, 20, 16, 0.12) !important;
}

.faculty-page .modern-card:hover {
    transform: translateY(-10px) !important;
    box-shadow: 0 26px 60px rgba(196, 22, 18, 0.2) !important;
}

.faculty-page .faculty-card-header {
    background: linear-gradient(145deg, #1a1410, #c41612) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.faculty-page .faculty-avatar {
    background: #ffffff !important;
    border: 2px solid rgba(196, 22, 18, 0.35);
    box-shadow: 0 14px 30px rgba(26, 20, 16, 0.2), 0 0 0 6px rgba(196, 22, 18, 0.12);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.faculty-page .modern-card:hover .faculty-avatar {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 18px 40px rgba(196, 22, 18, 0.26), 0 0 0 8px rgba(196, 22, 18, 0.18);
}

.faculty-page .faculty-avatar img {
    filter: saturate(1.05) contrast(1.03);
}

.modern-card-img {
    height: 200px;
    object-fit: cover;
    width: 100%;
    background-color: #f8f9fa;
    position: relative;
}

/* Default placeholder for images that fail to load */
img.modern-card-img:not([src]), 
img.modern-card-img[src=""],
img.image-fail {
    object-fit: contain !important;
    padding: 20px;
    background: linear-gradient(135deg, #f5f3f1 0%, #e9ecef 100%);
}

/* --- Utilities --- */
.section-spacing { padding: 5rem 0; }
.bg-gold { background-color: var(--kmitl-gold) !important; }

/* --- Responsive & Layout Fixes --- */
.home-narrow {
    max-width: 1160px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 15px;
    padding-right: 15px;
}

@media (max-width: 767.98px) {
    .section-spacing { padding: 3rem 0; }
    .section-title { font-size: 1.5rem; text-align: center; }
    .container, .container-fluid {
        padding-left: 20px;
        padding-right: 20px;
    }
}

@media (max-width: 575.98px) {
    .home-narrow {
        padding-left: 10px;
        padding-right: 10px;
    }
}
