/* ================================================
   Enhanced Bootstrap 4 Navbar for Unified Navigation
   Mobile-first responsive navigation system
   ================================================ */
:root {
    /* Override Bootstrap's primary color system with SP31 school colors */
    --bs-primary: #384772;
    --bs-primary-rgb: 56, 71, 114;

    /* Create darker variation for hover states */
    --sp31-primary-dark: #2c3659;
    --sp31-primary-dark-rgb: 44, 54, 89;

    /* Bootstrap navbar variable overrides */
    --bs-navbar-color: var(--bs-white);
    --bs-navbar-hover-color: var(--bs-white);
    --bs-navbar-active-color: var(--bs-white);
    --bs-navbar-brand-color: var(--bs-white);
    --bs-navbar-brand-hover-color: var(--bs-white);

    /* Dropdown menu variables */
    --bs-dropdown-bg: var(--sp31-primary-dark);
    --bs-dropdown-border-color: var(--sp31-primary-dark);
    --bs-dropdown-link-color: var(--bs-white);
    --bs-dropdown-link-hover-color: var(--bs-white);
    --bs-dropdown-link-hover-bg: var(--sp31-primary-dark);
}

/* Navigation base styles using Bootstrap variables */
.navbar {
    background: var(--sp31-primary-dark);
    border: none;
    border-radius: 0;
    min-height: 60px;
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
}

/* Account for fixed navbar height - different heights for mobile vs desktop */
@media (max-width: 767px) {
    body {
        padding-top: 80px;
        /* Mobile navbar is 80px tall */
    }
}

@media (min-width: 768px) {
    body {
        padding-top: 62px;
        /* Desktop navbar is ~60px tall + small buffer */
    }
}

/* ================================================
   Universal Navbar Link Styling - Fix Contrast Issues
   ================================================ */

/* Ensure consistent styling for all navbar links using Bootstrap variables */
.navbar-nav>li>a,
.navbar-nav>li>.dropdown-toggle {
    color: var(--bs-white);
    background-color: transparent;
}

/* Fix hover and active states using Bootstrap variables */
.navbar-nav>li>a:hover,
.navbar-nav>li>a:active,
.navbar-nav>li>a:focus,
.navbar-nav>li>.dropdown-toggle:hover,
.navbar-nav>li>.dropdown-toggle:active,
.navbar-nav>li>.dropdown-toggle:focus {
    background-color: var(--sp31-primary-dark);
    color: var(--bs-navbar-hover-color);
}

/* Ensure dropdown indicators remain visible */
.dropdown-toggle:after {
    color: var(--bs-navbar-color);
}

/* Prevent any Bootstrap default button-like styling */
.navbar-nav>li>a,
.navbar-nav>li>.dropdown-toggle {
    border: none !important;
    box-shadow: none !important;
    text-decoration: none !important;
    outline: none !important;
}

/* Additional safety: prevent any light backgrounds on click */
.navbar-nav>li>a:active:focus,
.navbar-nav>li>.dropdown-toggle:active:focus,
.navbar-nav>li>a.active,
.navbar-nav>li>.dropdown-toggle.active {
    background-color: var(--sp31-primary-dark);
    color: var(--bs-navbar-active-color);
    box-shadow: none !important;
}

.dropdown-menu {
    background-color: var(--sp31-primary-dark);
    border: 1px solid var(--sp31-primary-dark);
    border-radius: 4px !important;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175) !important;
}

/* Hero section positioning */
.hero-section {
    position: relative;
    z-index: 1;
}

/* Main page hero container positioning */
.container-fluid.p-0 {
    position: relative;
    z-index: 1;
}

/* Main content area positioning - consolidate inline styles */
.main-raised {
    margin-top: 15px;
}

/* Prevent body shifting when mobile menu opens */
@media (max-width: 767px) {
    body.mobile-nav-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }
}

/* Enhanced navbar toggle button for mobile ONLY */
@media (max-width: 767px) {
    .navbar {
        min-height: 80px;
    }

    /* Bootstrap 5 compatible navbar-toggler styling using variables */
    .navbar-toggler {
        background-color: var(--bs-primary);
        border: 2px solid var(--bs-white);
        border-radius: 6px;
        margin-top: 8px;
        margin-bottom: 8px;
        padding: 8px 10px;
    }

    .navbar-toggler:hover,
    .navbar-toggler:focus {
        background-color: var(--sp31-primary-dark);
        border-color: var(--bs-white);
        box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
    }
}

/* Tablet and Desktop Navigation: Show navbar, hide mobile elements */
@media (min-width: 768px) {

    /* Bootstrap 5 compatible desktop styling */
    /* Let Bootstrap 5 handle navbar structure naturally */

    /* Make sure the navigation is centered and visible */
    .navbar-nav {
        margin: 0 auto !important;
        text-align: center !important;
    }

    /* Ensure main navigation menu is visible and styled properly */
    #menu-bar {
        margin: 0 auto !important;
        text-align: center !important;
    }

    #menu-bar li {
        display: inline-block !important;
        float: none !important;
    }

    #menu-bar li a {
        display: block;
        color: #ffffff;
        font-size: 1.1rem;
        font-weight: 600 !important;
        text-shadow: none !important;
        padding: 10px 15px;
    }

    /* Hide mobile menu overlay */
    .mobile-menu-overlay {
        display: none !important;
    }

    /* Ensure dropdown menus work properly on desktop */
    .dropdown:hover .dropdown-menu {
        display: block;
        margin-top: 0;
    }

    .dropdown-menu {
        border: none;
        border-radius: 0;
        background-color: var(--sp31-primary-dark);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    }

    .dropdown-menu li a {
        color: var(--bs-white);
        padding: 10px 20px;
    }

    .dropdown-menu li a:hover {
        background-color: var(--bs-primary);
        color: var(--bs-white);
    }
}

/* Mobile Unified Nav - Main Container */
.mobile-unified-nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 85%;
    max-width: 400px;
    height: 100vh;
    z-index: 10001;
    background-color: var(--sp31-primary-dark);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

.mobile-unified-nav.active {
    display: block;
    transform: translateX(0);
}

/* Mobile Nav Overlay (backdrop) */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 10000;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.mobile-nav-overlay.active {
    display: block;
}

.mobile-menu-container {
    width: 100%;
    min-height: 100vh;
    background-color: #fff;
    margin-top: 60px;
    border-radius: 8px 8px 0 0;
}

/* Mobile nav header */
.mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--sp31-primary-dark);
    color: var(--bs-dropdown-link-color);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10001;
    height: 60px;
    box-sizing: border-box;
}

.mobile-nav-title {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
    color: var(--bs-dropdown-link-color);
}

.mobile-nav-close {
    background: none;
    border: none;
    color: var(--bs-dropdown-link-color);
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    line-height: 1;
}

.mobile-nav-close:hover,
.mobile-nav-close:focus {
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

/* Mobile nav content */
.mobile-nav-content {
    padding: 80px 0 20px 0;
    background-color: var(--sp31-primary-dark);
}

/* Mobile nav sections */
.mobile-nav-section {
    margin-bottom: 2px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.4);
}

.mobile-nav-section-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
    padding: 15px 20px 10px;
    margin: 0;
    letter-spacing: 0.5px;
}

/* Main navigation links */
.mobile-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-nav-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-nav-link {
    display: block;
    padding: 15px 20px;
    color: var(--bs-dropdown-link-color);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
}

.mobile-nav-link:hover,
.mobile-nav-link:focus {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--bs-dropdown-link-color);
    text-decoration: none;
}

/* Mobile nav toggle buttons (for submenus) */
.mobile-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 15px 20px;
    background: none;
    border: none;
    text-align: left;
    color: var(--bs-dropdown-link-color);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.mobile-nav-toggle:hover,
.mobile-nav-toggle:focus {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--bs-dropdown-link-color);
    outline: none;
}

.mobile-nav-toggle:active {
    background-color: rgba(255, 255, 255, 0.15);
}

/* Arrow indicator for toggles */
.mobile-nav-arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
    display: inline-block;
    margin-left: 8px;
}

.mobile-nav-toggle[aria-expanded="true"] .mobile-nav-arrow {
    transform: rotate(180deg);
}

/* Icon in toggle button */
.mobile-nav-icon {
    margin-right: 8px;
    font-size: 18px;
}

/* Submenus */
.mobile-nav-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.2);
    transition: max-height 0.3s ease-out;
}

.mobile-nav-submenu.active {
    max-height: 1000px;
    transition: max-height 0.5s ease-in;
}

.mobile-nav-submenu li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mobile-nav-submenu li:last-child {
    border-bottom: none;
}

.mobile-nav-sublink {
    display: block;
    padding: 12px 20px 12px 40px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 15px;
    font-weight: 400;
}

.mobile-nav-sublink:hover,
.mobile-nav-sublink:focus {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--bs-dropdown-link-color);
    text-decoration: none;
}

/* Legacy support for old class names */
.mobile-nav-list>li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-nav-list>li>a {
    display: block;
    padding: 15px 20px;
    color: var(--bs-dropdown-link-color);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
}

.mobile-nav-list>li>a:hover,
.mobile-nav-list>li>a:focus {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--bs-dropdown-link-color);
    text-decoration: none;
}


/* Mobile navigation overlay */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9998;
    display: none;
}

/* Hide legacy mobile menu elements */
@media (max-width: 767px) {
    .hidden-xs {
        display: none !important;
    }

    /* Allow proper Bootstrap grid behavior */
    [class*="col-"] {
        display: block !important;
    }

    /* Specifically hide the old przycisk.inc content */
    a[href="#menu"] {
        display: none !important;
    }

    /* Ensure hero images are visible on mobile */
    .visible-xs.top {
        display: block !important;
    }
}

/* Ensure hero images are visible on all screen sizes */
@media (min-width: 768px) and (max-width: 991px) {
    .visible-sm.top {
        display: block !important;
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .visible-md.top {
        display: block !important;
    }
}

@media (min-width: 1200px) {
    .visible-lg.top {
        display: block !important;
    }
}

/* ================================================
   Desktop Keyboard Navigation Enhancements
   ================================================ */

@media (min-width: 992px) {

    /* Enhanced focus indicators for desktop navigation */
    .navbar-nav>li>a:focus,
    .navbar-nav>li>.dropdown-toggle:focus {
        outline: 3px solid #66b3ff;
        outline-offset: 2px !important;
        background-color: #f8f9fa;
        color: var(--bs-primary);
        z-index: 1001 !important;
        position: relative !important;
    }

    /* Fix for clicked/active menu items - ensure good contrast */
    .navbar-nav>li>a:active,
    .navbar-nav>li>a:hover,
    .navbar-nav>li>.dropdown-toggle:active,
    .navbar-nav>li>.dropdown-toggle:hover {
        background-color: var(--bs-primary);
        color: var(--bs-white);
    }

    /* Override Bootstrap's default light gray active state */
    .navbar-nav>li>a:visited {
        background-color: transparent;
        color: var(--bs-white);
    }

    /* Dropdown menu keyboard accessibility */
    .dropdown-menu {
        display: none !important;
    }

    .dropdown.open .dropdown-menu,
    .dropdown.show .dropdown-menu {
        display: block !important;
        background-color: var(--sp31-primary-dark);
    }

    /* Enhanced dropdown menu styling */
    .dropdown-menu {
        background-color: var(--sp31-primary-dark);
        border: 1px solid #dee2e6;
        border-radius: 4px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
        padding: 8px 0 !important;
        margin-top: 2px !important;
        z-index: 1000 !important;
    }

    /* Dropdown menu items */
    .dropdown-menu>li>a {
        padding: 8px 20px !important;
        /* color: #333; */
        text-decoration: none !important;
        display: block !important;
        clear: both !important;
        font-weight: normal !important;
        line-height: 1.5 !important;
        white-space: nowrap !important;
    }

    /* Skip to content link for keyboard navigation */
    .skip-navigation {
        position: absolute !important;
        top: -40px !important;
        left: 6px !important;
        background: #000;
        color: #fff;
        padding: 8px 12px !important;
        text-decoration: none !important;
        z-index: 10000 !important;
        border-radius: 0 0 4px 4px !important;
        font-size: 14px !important;
        font-weight: bold !important;
        transition: top 0.2s ease !important;
    }

    .skip-navigation:focus {
        top: 0 !important;
        outline: 3px solid #ffff00 !important;
        outline-offset: 2px !important;
    }
}

/* ================================================
   Hero Section Background Styling
   Consolidates inline background styles from hero.inc.php
   ================================================ */

/* Hero background for all breakpoints */
.hero-background-blue {
    background: #4D659E !important;
}

/* Hero section margin-bottom styling */
.hero-section {
    margin-bottom: 8px;
}

/* ================================================
   Form Styling - Consolidated from inline styles
   ================================================ */

/* Standard form container styling */
.form-container {
    width: 500px;
    margin: 20px auto;
    border: 2px solid #ccc;
    padding: 20px;
}

/* Form label styling using Bootstrap variables */
.form-label-standard {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 1.5em;
    color: var(--bs-primary);
}

/* Standard form input styling */
.form-input-standard {
    padding: 5px;
    border: 1px solid #ccc;
    margin-bottom: 25px;
    width: 100%;
    box-sizing: border-box;
}

/* Large form input styling (for RODO forms) */
.form-input-large {
    font-size: 1.8em;
    width: 400px;
    padding: 5px;
    border: 1px solid #ccc;
    margin-bottom: 15px;
    box-sizing: border-box;
}

/* Form textarea styling */
.form-textarea-large {
    font-size: 1.8em;
    width: 450px;
    height: 150px;
    padding: 5px;
    margin-bottom: 15px;
}

/* Form submit button styling */
.form-submit-standard {
    cursor: pointer;
    margin-bottom: 0px;
}

/* ================================================
   Image Spacing - Biblioteca Section
   ================================================ */

/* Standard biblioteca image spacing */
.biblioteca-image-spacing {
    margin-top: 20px;
}

/* Biblioteca image with left margin */
.biblioteca-image-offset {
    margin-left: 50px;
    margin-top: 20px;
}

/* ================================================
   Table and Layout Utilities
   ================================================ */

/* Center-offset table positioning */
.table-center-offset {
    margin-left: 20%;
}

/* Generic section bottom spacing */
.section-bottom-spacing {
    padding-bottom: 10px;
}

/* Table margin top percentage */
.table-margin-top-3 {
    margin-top: 3%;
}

/* ================================================
   Accessibility Panel Styling
   ================================================ */

/* Accessibility shortcut group spacing */
.accessibility-shortcut-group {
    margin-top: 8px;
}

/* Small text styling for accessibility panel */
.accessibility-small-text {
    margin-top: 6px;
    font-size: 10px;
    font-style: italic;
    color: #888;
}