/* Premium Theme - Modern UI/UX replacing legacy styles */
:root {
    --bs-primary: #6366f1; /* Modern Indigo */
    --bs-primary-rgb: 99, 102, 241;
    --bs-secondary: #8b5cf6; /* Modern Violet */
    --bs-secondary-rgb: 139, 92, 246;
    --bs-dark: #1e293b;
    --bs-light: #f8fafc;
    --bs-body-font-family: 'Prompt', sans-serif;
    --bs-body-bg: #f1f5f9;
}

html, body {
    overflow-x: hidden;
    width: 100%;
}

body {
    background-color: var(--bs-body-bg);
    color: #334155;
    padding-top: 80px; /* Space for fixed navbar */
    font-family: var(--bs-body-font-family);
}

/* Navbar Default Background */
.navbar {
    background: #ffffff !important;
}

/* Glassmorphism Utilities */
.glass-nav {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(12px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}
/* Fix for mobile offcanvas bug caused by backdrop-filter */
@media (max-width: 1199.98px) {
    .glass-nav {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background: rgba(255, 255, 255, 0.98) !important;
    }
}
/* Fix scroll chaining for mobile offcanvas (iOS/Android) */
.offcanvas, .offcanvas-body {
    overscroll-behavior: contain;
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.95) !important;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
}

.glass-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 25px rgba(0,0,0,0.03);
}

/* Gradient Utilities */
.text-gradient {
    background: linear-gradient(135deg, var(--bs-primary), var(--bs-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--bs-primary), var(--bs-secondary)) !important;
    color: white;
}

/* Micro Animations */
.hover-lift {
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s ease;
}
.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.08) !important;
}

/* Navbar specifics */
.navbar-brand {
    font-weight: 700;
    color: var(--bs-primary) !important;
    font-size: clamp(1rem, 2vw + 0.5rem, 1.25rem);
    white-space: normal;
    max-width: 50%;
    line-height: 1.2;
}
@media (max-width: 1199.98px) {
    .navbar-brand {
        max-width: 75%; /* Leaves space for the mobile hamburger menu */
    }
}
.navbar-nav .nav-link {
    font-weight: 500;
    font-size: 0.85rem !important;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
    color: #475569 !important;
    transition: color 0.3s ease;
}
.navbar-nav .nav-link:hover {
    color: var(--bs-primary) !important;
}
.navbar.scrolled .navbar-brand,
.navbar.scrolled .navbar-nav .nav-link,
.navbar.scrolled .navbar-toggler i {
    color: var(--bs-dark) !important;
}

/* Desktop Dropdown Hover */
@media (min-width: 1200px) {
    .dropdown:hover > .dropdown-menu {
        display: block;
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    .dropdown-menu {
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
        border: none;
        border-radius: 12px;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
        padding: 0.5rem;
        min-width: 350px; /* Force uniform width for all dropdowns */
        max-width: 380px; /* Prevent overly wide dropdowns */
    }
    
    /* Scrollable Dropdown Variant */
    .dropdown-menu-scrollable {
        max-height: 70vh; /* 70% of viewport height */
        overflow-y: auto;
        overscroll-behavior: contain; /* Prevent scrolling the main page when reaching the end */
    }
    /* Custom Scrollbar for Dropdown */
    .dropdown-menu-scrollable::-webkit-scrollbar {
        width: 5px;
    }
    .dropdown-menu-scrollable::-webkit-scrollbar-track {
        background: transparent;
    }
    .dropdown-menu-scrollable::-webkit-scrollbar-thumb {
        background-color: rgba(99, 102, 241, 0.2);
        border-radius: 10px;
    }
    .dropdown-menu-scrollable::-webkit-scrollbar-thumb:hover {
        background-color: rgba(99, 102, 241, 0.5);
    }
    .dropdown-item {
        border-radius: 6px;
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
        transition: background-color 0.2s;
        white-space: normal; /* Allow long text to wrap */
        line-height: 1.4;
    }
    .dropdown-item:hover {
        background-color: #f1f5f9;
        color: var(--bs-primary);
    }

    .dropdown-submenu { position: relative; }
    .dropdown-submenu .dropdown-menu {
        top: 0;
        left: 100%;
        margin-top: -5px;
    }
    .dropdown-submenu:hover > .dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}

/* Mobile Navbar Overrides */
@media (max-width: 1199.98px) {
    .navbar-collapse {
        background: white;
        padding: 1rem;
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.1);
        margin-top: 1rem;
    }
    .navbar-nav .nav-link, .navbar-nav .dropdown-item {
        color: #334155 !important;
        padding: 0.75rem 1rem !important;
        border-radius: 8px;
        white-space: normal; /* Allow long text to wrap on mobile */
        word-break: break-word; /* Ensure extremely long words don't overflow */
    }
    .navbar-nav .nav-link:hover, .navbar-nav .dropdown-item:hover {
        background: #f1f5f9 !important;
    }
    .navbar-nav .dropdown-menu {
        border: none;
        background: transparent;
        box-shadow: none;
        padding-left: 1rem;
    }
    .navbar-toggler i {
        color: var(--bs-primary) !important;
    }
}

/* Fix navbar item overflow on medium-large screens */
@media (min-width: 1200px) and (max-width: 1399.98px) {
    .navbar-nav .nav-link {
        font-size: 0.75rem !important;
        padding-left: 0.3rem !important;
        padding-right: 0.3rem !important;
    }
}

/* Specific Component Resets from old code */
.header-image-section {
    position: relative;
    height: 400px;
    background-size: cover;
    background-position: center;
    border-radius: 20px;
    margin-bottom: 2rem;
    overflow: hidden;
}
.header-image-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.1), rgba(0,0,0,0.6));
}

.banner-slide {
    height: 400px;
    background-size: cover;
    background-position: center;
    border-radius: 20px;
}

.news-image {
    height: 200px;
    background-size: cover;
    background-position: center;
    border-radius: 12px 12px 0 0;
}

.personnel-mini-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    margin: 0 auto 10px;
    border: 3px solid white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.personnel-avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    margin: 0 auto 15px;
    border: 4px solid white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.personnel-list-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    border: 3px solid white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.hover-bg-light:hover { background-color: rgba(99, 102, 241, 0.08) !important; }

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--bs-primary), var(--bs-secondary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: none;
    cursor: pointer;
    text-decoration: none;
}
.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.back-to-top:hover {
    color: white;
    transform: translateY(-5px);
    box-shadow: 0 15px 25px rgba(139, 92, 246, 0.4);
}

/* ==========================================================================
   Premium Footer Styles
   ========================================================================== */
.premium-footer {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: rgba(255, 255, 255, 0.8);
    position: relative;
}

.footer-brand i {
    background: linear-gradient(135deg, #6366f1, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.social-btn:hover {
    transform: translateY(-3px);
    color: white;
}
.social-btn.facebook:hover { background: #1877f2; }
.social-btn.youtube:hover { background: #ff0000; }
.social-btn.line:hover { background: #00c300; }
.social-btn.website:hover { background: var(--bs-primary); }

.footer-heading {
    display: inline-block;
}

.footer-heading::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -10px;
    width: 30px;
    height: 3px;
    background: var(--bs-primary);
    border-radius: 3px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 0.3rem 0;
    transition: all 0.3s ease;
}

.footer-links a i {
    transition: transform 0.3s ease;
}

.footer-links a:hover {
    color: white;
    transform: translateX(5px);
}

.footer-links a:hover i {
    transform: translateX(3px);
}

.related-link-card {
    border: 1px solid rgba(255,255,255,0.05);
}

.related-link-card:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    transform: translateX(5px);
    border-color: rgba(255,255,255,0.2);
}

.category-link-card {
    border: 1px solid rgba(0,0,0,0.05);
    background: rgba(255, 255, 255, 0.75);
}

.category-link-card:hover {
    background: rgba(99, 102, 241, 0.05) !important;
    transform: translateX(5px);
    border-color: rgba(99, 102, 241, 0.2);
}

.animation-pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}
