/* =========================================
   DIVINE MERCY CHURCH NAVBAR
   Cleaned and consolidated stylesheet
   Theme: White + Red (#bf0a30)
========================================= */

/* Prevent horizontal overflow */
html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* Main fixed navbar */
.fixed-navbar {
    width: 100%;
    height: auto;
    min-height: 90px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background: #fff;
    border-bottom: 1px solid #eee;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
}

/* Keep logo and toggler aligned */
.fixed-navbar > .container-fluid {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

/* Logo */
.fixed-navbar .navbar-brand {
    flex-shrink: 0;
    margin-right: 10px;
    color: #bf0a30;
    text-decoration: none;
    font-weight: 700;
}

.fixed-navbar .navbar-brand h1 {
    margin: 0;
    font-size: clamp(20px, 1.8vw, 28px);
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
    white-space: nowrap;
}

.brand-dark {
    color: #111;
}

.brand-name {
    color: #bf0a30;
}

/* Navigation layout */
.fixed-navbar .navbar-collapse {
    flex-grow: 1;
    min-width: 0;
    background: #fff;
}

.fixed-navbar .navbar-nav {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0;
}

.fixed-navbar .navbar-nav .nav-link {
    position: relative;
    padding: 12px 8px;
    color: #111;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    transition: color 0.3s ease;
}

.fixed-navbar .nav-link:hover,
.fixed-navbar .nav-link.active {
    color: #bf0a30;
}

/* Active / hover underline */
.fixed-navbar .nav-link::before {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 4px;
    height: 3px;
    background: #bf0a30;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.fixed-navbar .nav-link:hover::before,
.fixed-navbar .nav-link.active::before {
    transform: scaleX(1);
}

/* Mobile menu toggler */
.fixed-navbar .navbar-toggler {
    padding: 8px 12px;
    background: #bf0a30;
    border: 2px solid #bf0a30;
    border-radius: 4px;
    box-shadow: none;
}

.fixed-navbar .navbar-toggler:hover {
    background: #bf0a30;
    border-color: #bf0a30;
}

.fixed-navbar .navbar-toggler:focus {
    box-shadow: none;
}

/* Main dropdown */
.fixed-navbar .nav-item > .dropdown-menu {
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 230px;
    padding: 8px 0;
    background: #fff;
    border: 0;
    border-top: 3px solid #bf0a30;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    visibility: hidden;
    opacity: 0;
    transform: translateY(10px);
    transition:
        opacity 0.25s ease,
        transform 0.25s ease,
        visibility 0.25s ease;
}

.fixed-navbar .nav-item:hover > .dropdown-menu {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

/* Nested submenu - desktop */
.fixed-navbar .dropdown-submenu {
    position: relative;
}

.fixed-navbar .dropdown-submenu > .dropdown-menu {
    display: block;
    position: absolute;
    top: -8px;
    left: 100%;
    margin-left: 3px;
    border-top: 3px solid #bf0a30;
    min-width: 220px;
    z-index: 1060;
    visibility: hidden;
    opacity: 0;
    transform: translateX(10px);
    transition:
        opacity 0.25s ease,
        transform 0.25s ease,
        visibility 0.25s ease;
}

.fixed-navbar .dropdown-submenu:hover > .dropdown-menu {
    visibility: visible;
    opacity: 1;
    transform: translateX(0);
}

/* Arrow for nested submenu */
.fixed-navbar .dropdown-submenu > .dropdown-toggle::after {
    float: right;
    margin-top: 6px;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 5px solid currentColor;
    border-right: 0;
}

/* Responsive navbar */
@media (max-width: 1199.98px) {
    .fixed-navbar > .container-fluid {
        flex-wrap: wrap;
    }

    .fixed-navbar .navbar-collapse {
        flex-basis: 100%;
        width: 100%;
    }

    .fixed-navbar .navbar-nav {
        align-items: stretch;
        flex-wrap: wrap;
    }

    .fixed-navbar .navbar-nav .nav-link {
        padding: 12px 15px;
        font-size: 15px;
    }

    .fixed-navbar .navbar-collapse .nav-link::before {
        display: none;
    }

    /* Main dropdown stays in the mobile menu flow */
    .fixed-navbar .nav-item > .dropdown-menu {
        position: static;
        min-width: 0;
        width: 100%;
        transform: none;
        visibility: visible;
        opacity: 1;
        box-shadow: none;
        border-radius: 0;
        display: none;
    }

    .fixed-navbar .nav-item > .dropdown-menu.show {
        display: block;
    }

    /* Nested submenu opens below its parent and scrolls */
    .fixed-navbar .dropdown-submenu {
        position: static;
        width: 100%;
    }

    .fixed-navbar .dropdown-submenu > .dropdown-menu {
        position: static;
        top: auto;
        left: auto;
        right: auto;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        max-height: 180px;
        margin: 0;
        padding: 5px 0 5px 15px;
        overflow-y: auto;
        overflow-x: hidden;
        background: #fff;
        border: 0;
        border-left: 3px solid #bf0a30;
        border-radius: 0;
        box-shadow: none;
        display: none;
        transform: none;
        visibility: visible;
        opacity: 1;
    }

    .fixed-navbar .dropdown-submenu > .dropdown-menu.show {
        display: block;
    }

    .fixed-navbar .dropdown-submenu:hover > .dropdown-menu:not(.show) {
        display: none;
    }

    .fixed-navbar .dropdown-submenu > .dropdown-menu .dropdown-item {
        display: block;
        width: 100%;
        padding: 10px 15px;
        color: #212529;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .fixed-navbar .dropdown-submenu > .dropdown-menu .dropdown-item:hover,
    .fixed-navbar .dropdown-submenu > .dropdown-menu .dropdown-item:focus {
        background: #f8f8f8;
        color: #bf0a30;
    }

    /* Red scrollbar for nested submenu */
    .fixed-navbar .dropdown-submenu > .dropdown-menu::-webkit-scrollbar {
        width: 6px;
    }

    .fixed-navbar .dropdown-submenu > .dropdown-menu::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    .fixed-navbar .dropdown-submenu > .dropdown-menu::-webkit-scrollbar-thumb {
        background: #bf0a30;
        border-radius: 6px;
    }

    .fixed-navbar .dropdown-submenu > .dropdown-menu::-webkit-scrollbar-thumb:hover {
        background: #900820;
    }
}

/* Small mobile logo sizing */
@media (max-width: 575.98px) {
    .fixed-navbar .navbar-brand {
        margin-right: 10px;
    }

    .fixed-navbar .navbar-brand h1 {
        font-size: 20px;
        letter-spacing: -0.4px;
    }
}

/* Laptop nav spacing */
@media (min-width: 1200px) and (max-width: 1399.98px) {
    .fixed-navbar .navbar-nav .nav-link {
        font-size: 13px;
        padding-left: 5px;
        padding-right: 5px;
    }
}

/* Large desktop nav spacing */
@media (min-width: 1400px) {
    .fixed-navbar .navbar-nav .nav-link {
        font-size: 15px;
        padding-left: 8px;
        padding-right: 8px;
    }
}
/* ========================== */
@media (max-width: 1199.98px) {
    .fixed-navbar .dropdown-submenu > .dropdown-menu {
        position: static !important;
        max-height: 150px !important;
        height: auto !important;
        overflow-y: scroll !important;
        overflow-x: hidden !important;
        width: 100% !important;
        margin: 0 !important;
        border-top: 0 !important;
        border-left: 3px solid #bf0a30 !important;
        box-shadow: none !important;
    }

    .fixed-navbar .dropdown-submenu > .dropdown-menu::-webkit-scrollbar {
        width: 6px;
    }

    .fixed-navbar .dropdown-submenu > .dropdown-menu::-webkit-scrollbar-thumb {
        background: #bf0a30;
        border-radius: 6px;
    }
}
