/* Bootstrap 5.3.2 Navbar Overrides */
:root {
    /* Default Bootstrap navbar variables with updated colors */
    --bs-navbar-padding-x: 0;
    --bs-navbar-padding-y: 0.5rem;
    --bs-navbar-color: rgba(255, 255, 255, 0.85);
    --bs-navbar-hover-color: #ffffff;
    --bs-navbar-disabled-color: rgba(255, 255, 255, 0.25);
    --bs-navbar-active-color: #ffffff;
    --bs-navbar-brand-padding-y: 0.3125rem;
    --bs-navbar-brand-margin-end: 1rem;
    --bs-navbar-brand-font-size: 1.25rem;
    --bs-navbar-brand-color: #ffffff;
    --bs-navbar-brand-hover-color: #ffc300;
    --bs-navbar-nav-link-padding-x: 0.5rem;
    --bs-navbar-toggler-padding-y: 0.25rem;
    --bs-navbar-toggler-padding-x: 0.75rem;
    --bs-navbar-toggler-font-size: 1.25rem;
    --bs-navbar-toggler-icon-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    --bs-navbar-toggler-border-color: rgba(255, 255, 255, 0.3);
    --bs-navbar-toggler-border-radius: 0.375rem;
    --bs-navbar-toggler-focus-width: 0.25rem;
    --bs-navbar-toggler-transition: box-shadow 0.15s ease-in-out;
}

/* NavMenu Styling */
.navbar-dark {
    background-color: #000000 !important; /* Changed from blue to black */
}

.top-row {
    background-color: #000000 !important; /* Changed from blue to black */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar {
    background-color: #000000 !important; /* Changed from gradient to solid black */
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    display: block !important;
}

.navbar-brand {
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.navbar-brand:hover {
    color: #ffc300 !important;
}

.nav-item {
    font-size: 0.95rem !important;
    padding-bottom: 0.5rem;
    margin-top: 0.5rem;
}

.nav-item .nav-link {
    color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    border-radius: 4px;
    height: 3rem;
    transition: all 0.2s ease-in-out;
}

.nav-item .nav-link:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-item .nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff !important;
    font-weight: 600;
}

.nav-item .fas,
.nav-item .oi {
    width: 2rem;
    font-size: 1.1rem;
    vertical-align: middle;
    top: -2px;
    color: #ffc300 !important;
    margin-right: 0.5rem;
}

.navbar-toggler {
    background-color: rgba(255, 255, 255, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    padding: 0.5rem !important;
    color: white !important;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.1rem #ffc300 !important;
    outline: none !important;
}

.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%28255, 255, 255, 0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* Make sure dropdown dividers are visible */
.dropdown-divider.bg-light {
    border-top: 1px solid rgba(255, 255, 255, 0.3) !important;
    opacity: 1 !important;
}

/* Main Layout Styling */
.page {
    position: relative;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

.top-row {
    border-bottom: 1px solid #d6d5d5;
    justify-content: flex-end;
    height: 3.5rem;
    display: flex;
    align-items: center;
}

/* Fix for black text on black background in the top row of NavMenu */
.navbar-dark .top-row a, 
.navbar-dark .top-row .btn-link {
    white-space: nowrap;
    margin-left: 1.5rem;
    text-decoration: none;
    color: #ffffff !important;
    font-weight: 500;
}

.navbar-dark .top-row a:hover, 
.navbar-dark .top-row .btn-link:hover {
    text-decoration: underline;
    color: #ffc300 !important;
}

/* For main layout top row (not in navbar) */
main .top-row a, 
main .top-row .btn-link {
    white-space: nowrap;
    margin-left: 1.5rem;
    text-decoration: none;
    color: #000000 !important;
    font-weight: 500;
}

main .top-row a:hover, 
main .top-row .btn-link:hover {
    text-decoration: underline;
    color: #ffc300 !important;
}

.top-row a:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-greeting {
    color: #000000 !important;
    font-weight: 500;
    font-size: 0.95rem;
}

/* Button override to ensure visibility */
.btn-link.nav-link {
    color: #ffffff !important;
    text-align: left;
    padding: 0;
    background: transparent !important;
    border: none;
    text-decoration: none;
}

.btn-link.nav-link:hover {
    color: #ffc300 !important;
    text-decoration: none;
}

/* Special emphasis on logout button to ensure visibility */
form .btn-link.nav-link,
.nav-item form button[type="submit"] {
    background: transparent !important;
    color: #ffffff !important;
    text-decoration: none !important;
    border: none !important;
}

form .btn-link.nav-link:hover,
.nav-item form button[type="submit"]:hover {
    color: #ffc300 !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

/* Mobile-specific styling */
@media (max-width: 640.98px) {
    .top-row:not(.auth) {
        display: none;
    }

    .top-row.auth {
        justify-content: space-between;
    }

    .top-row a, .top-row .btn-link {
        margin-left: 0;
    }
    
    /* Ensure mobile menu is visible */
    .navbar-collapse.show {
        background-color: #000000;
        padding: 1rem;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }
    
    /* Better mobile toggle spacing */
    .navbar-toggler {
        margin-right: 0.5rem;
        display: block !important;
    }
    
    /* Improve brand text size on mobile */
    .navbar-brand {
        font-size: 1.1rem !important;
        max-width: 200px;
    }
    
    /* Navbar overlay for mobile */
    .nav-scrollable.show {
        position: fixed;
        top: 3.5rem;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1050;
        overflow-y: auto;
        padding-bottom: 70px;
        display: block !important;
    }
    
    /* Close overlay button */
    .menu-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        display: none;
    }
    
    .menu-backdrop.show {
        display: block;
    }
    
    /* Force sidebar to be hidden on mobile by default */
    .sidebar {
        display: none !important;
    }
}

/* Desktop-specific styling */
@media (min-width: 641px) {
    .page {
        flex-direction: row;
    }

    .sidebar {
        width: 250px;
        height: 100vh;
        position: sticky;
        top: 0;
        display: block !important;
    }

    .top-row {
        position: sticky;
        top: 0;
        z-index: 1;
    }

    .top-row.auth a:first-child {
        flex: 1;
        text-align: right;
        width: 0;
    }

    .top-row, article {
        padding-left: 2rem !important;
        padding-right: 1.5rem !important;
    }
    
    /* Hide hamburger menu on desktop */
    .navbar-toggler {
        display: none !important;
    }
    
    /* Always show nav menu on desktop */
    .nav-scrollable {
        display: block !important;
        height: calc(100vh - 3.5rem);
        overflow-y: auto;
    }
    
    /* Always display the sidebar on desktop */
    .sidebar {
        display: block !important;
    }
}

/* Bootstrap's navbar core structure */
.navbar {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: var(--bs-navbar-padding-y) var(--bs-navbar-padding-x);
}

.navbar > .container,
.navbar > .container-fluid {
    display: flex;
    flex-wrap: inherit;
    align-items: center;
    justify-content: space-between;
}

.navbar-nav {
    display: flex;
    flex-direction: column;
    padding-left: 0;
    margin-bottom: 0;
    list-style: none;
}

.navbar-collapse {
    display: flex;
    flex-basis: 100%;
    flex-grow: 1;
    align-items: center;
}

/* Bootstrap collapsible navbar */
.collapse:not(.show) {
    display: none !important;
}

.collapse.show {
    display: block !important;
}

.collapsing {
    height: 0;
    overflow: hidden;
    transition: height 0.35s ease;
}

/* Fix for nav-scrollable to ensure proper visibility */
.nav-scrollable {
    overflow-y: auto;
    display: block !important;
}

/* Ensure nav-scrollable is visible on desktop */
@media (min-width: 641px) {
    .nav-scrollable {
        /* Never collapse the sidebar for wide screens */
        display: block !important;
        height: calc(100vh - 3.5rem);
        overflow-y: auto;
    }
}

/* Modal Styling */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0,0,0,0.5);
    z-index: 1040;
}

.modal {
    z-index: 1050;
}

.modal-dialog {
    margin: 1.75rem auto;
    max-width: 500px;
}

.modal-content {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.modal-header {
    border-bottom: 1px solid #dee2e6;
    padding: 1rem 1rem 0.5rem;
}

.modal-body {
    padding: 1rem;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    padding: 0.5rem 1rem 1rem;
}

/* Form Styling */
.validation-message {
    color: #dc3545;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.form-control:invalid {
    border-color: #dc3545;
}

.form-control:valid {
    border-color: #198754;
}

/* Hide the blazor error UI by default */
#blazor-error-ui {
    display: none;
}

/* Custom doggie bus branding styles */
.doggie-primary-color {
    color: #000000 !important; /* Changed from blue to black */
}

.doggie-secondary-color {
    color: #ffc300 !important;
}

/* NavMenu Styling - Make sure these styles are included in site.css */
.navbar-collapse {
    display: flex;
    flex-basis: 100%;
    flex-grow: 1;
    align-items: center;
}

.navbar-collapse.collapse {
    display: none !important;
}

.navbar-collapse.collapse.show {
    display: block !important;
}

@media (min-width: 641px) {
    .navbar-collapse.collapse {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
    }
    
    .navbar-toggler {
        display: none;
    }
}

/* Ensure menu is fully visible on mobile when expanded */
#navMenu {
    transition: height 0.35s ease;
}

#navMenu.show {
    max-height: 1000px; /* Large enough to fit all menu items */
}

#navMenu:not(.show) {
    max-height: 0;
    overflow: hidden;
}

@media (min-width: 641px) {
    #navMenu {
        max-height: none !important;
        overflow: visible !important;
    }
}

/* Explicitly set text color for navigation menu items */
.sidebar .nav-item .nav-link {
    color: #ffffff !important;
}

.sidebar .nav-item .fas,
.sidebar .nav-item .oi {
    color: #ffc300 !important;
}

/* Login page specific styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
}

/* Override any conflicting navbar styles for login page */
.login-container + .sidebar,
.login-container ~ .sidebar {
    display: none !important;
}