/* Shared Navigation Styles */

/* Fallback theme variables for pages that don't load style.default.css */
:root {
    --navy: var(--navy, #007EA3);
    --navy-hover: var(--navy-hover, #006280);
}

/* Navbar Base - also overrides conflicting legacy styles in style.default.css */
nav.navbar {
    background: var(--navy, #007EA3);
    padding: 0.5rem 1rem;
    position: relative;
    z-index: 1001;
}

nav.navbar a {
    font-size: inherit;
    position: static;
}

nav.navbar .badge {
    position: static;
}

nav.navbar .dropdown-menu {
    width: auto;
    float: none;
    margin-top: 0.5rem;
    padding: 0.5rem 0;
    font-size: inherit;
}

nav.navbar .dropdown-menu a {
    font-size: 0.9rem;
    color: #495057;
    padding: 0.5rem 1rem;
}

nav.navbar a.menu-btn {
    width: auto;
    height: auto;
    line-height: normal;
    background: transparent;
    text-align: inherit;
    padding: 0.5rem 1rem !important;
}

nav.navbar a.menu-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Navbar */
.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
    color: #ffffff !important;
}

.navbar-brand:hover {
    color: #f8f9fa !important;
}

.nav-link {
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #ffffff !important;
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #ffffff !important;
}

/* Drop the default Bootstrap focus glow on nav links */
.nav-link:focus-visible {
    box-shadow: none !important;
}

.navbar-toggler {
    border: none;
    color: #ffffff;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

/* Dropdown Menu */
.dropdown-menu {
    background-color: #ffffff !important;
    border: 1px solid rgba(0,0,0,0.15) !important;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-top: 0.5rem;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    color: #495057 !important;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    color: #212529;
}

.dropdown-item i {
    width: 16px;
    margin-right: 8px;
    text-align: center;
}

/* Client Selector */
#client-selector {
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    min-width: 200px;
}

#client-selector:focus {
    border-color: rgba(255, 255, 255, 0.5);
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

#client-selector option {
    background-color: #ffffff;
    color: #495057;
}

/* User Info */
.navbar-text {
    color: rgba(255, 255, 255, 0.8) !important;
    font-weight: 500;
}

/* Theme Selector */
.theme-selector {
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.15);
    background-color: #ffffff;
    color: #495057;
    min-width: 150px;
}

.theme-selector:focus {
    border-color: rgba(0,0,0,0.25);
    background-color: #ffffff;
    color: #495057;
    box-shadow: 0 0 0 0.2rem rgba(0,0,0,0.25);
}

.theme-selector option {
    background-color: #ffffff;
    color: #495057;
}

/* User Dropdown */
.dropdown-menu-end {
    right: 0;
    left: auto;
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
}

.dropdown-item i {
    width: 16px;
    margin-right: 8px;
    text-align: center;
}

/* Client Selector in Dropdown */
#client-selector-dropdown {
    border-radius: 6px;
    border: 1px solid #ced4da;
    background-color: #ffffff;
    color: #495057;
    font-size: 0.875rem;
}

#client-selector-dropdown:focus {
    border-color: #86b7fe;
    background-color: #ffffff;
    color: #495057;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

#client-selector-dropdown option {
    background-color: #ffffff;
    color: #495057;
}

/* Dark Mode Styles */
html[data-theme="dark"] .navbar {
    background: linear-gradient(135deg, #333 0%, #1a1a1a 100%) !important;
    border-bottom: 1px solid #4a5568;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

html[data-theme="dark"] .navbar-brand,
html[data-theme="dark"] .nav-link,
html[data-theme="dark"] .navbar-text {
    color: #e9ecef !important;
}

html[data-theme="dark"] .navbar-brand:hover,
html[data-theme="dark"] .nav-link:hover {
    color: #ffffff !important;
}

html[data-theme="dark"] .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .dropdown-menu {
    background-color: #343434;
    border: 1px solid black;
    box-shadow: 0 4px 6px rgba(0,0,0,0.5);
}

html[data-theme="dark"] .dropdown-item {
    color: #e9ecef;
}

html[data-theme="dark"] .dropdown-item:hover {
    background-color: #374151;
    color: #ffffff !important;
}

html[data-theme="dark"] #client-selector {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: #4a5568;
    color: #e9ecef;
}

html[data-theme="dark"] #client-selector:focus {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: #63b3ed;
    color: #e9ecef;
    box-shadow: 0 0 0 0.2rem rgba(99, 179, 237, 0.25);
}

html[data-theme="dark"] #client-selector option {
    background-color: #2d3748;
    color: #e9ecef;
}

html[data-theme="dark"] #client-selector-dropdown {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: #4a5568;
    color: #e9ecef;
}

html[data-theme="dark"] #client-selector-dropdown:focus {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: #63b3ed;
    color: #e9ecef;
    box-shadow: 0 0 0 0.2rem rgba(99, 179, 237, 0.25);
}

html[data-theme="dark"] .theme-selector {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: #4a5568;
    color: #e9ecef;
}

html[data-theme="dark"] .theme-selector:focus {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: #63b3ed;
    color: #e9ecef;
    box-shadow: 0 0 0 0.2rem rgba(99, 179, 237, 0.25);
}

html[data-theme="dark"] .theme-selector option {
    background-color: #2d3748;
    color: #e9ecef;
}

/* --- Unified navbar dropdown selects (client / theme / background) ---------
   The three selects share one look and fill the width of the dropdown row.
   The client selector previously used a blue focus glow and a wider min-width;
   this brings it in line with .theme-selector (.background-selector had only
   Bootstrap defaults). */
nav.navbar .dropdown-menu .theme-selector,
nav.navbar .dropdown-menu .background-selector,
nav.navbar .dropdown-menu #client-selector-dropdown {
    flex: 1 1 0;
    width: 100%;
    min-width: 0 !important;            /* override inline min-width:150/180px */
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    background-color: #ffffff;
    color: #495057;
    font-size: 0.875rem;
}
nav.navbar .dropdown-menu .theme-selector:focus,
nav.navbar .dropdown-menu .background-selector:focus,
nav.navbar .dropdown-menu #client-selector-dropdown:focus {
    border-color: rgba(0, 0, 0, 0.25);
    box-shadow: 0 0 0 0.2rem rgba(0, 0, 0, 0.25);
    background-color: #ffffff;
    color: #495057;
}
/* The client selector sits inside a <form> — let it fill the row too (it
   carries .w-100, which we override so flex-grow controls the width). */
nav.navbar .dropdown-menu #client-form-dropdown {
    flex: 1 1 0;
    width: auto !important;
    min-width: 0;
}
html[data-theme="dark"] nav.navbar .dropdown-menu .theme-selector,
html[data-theme="dark"] nav.navbar .dropdown-menu .background-selector,
html[data-theme="dark"] nav.navbar .dropdown-menu #client-selector-dropdown {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: #4a5568;
    color: #e9ecef;
}
html[data-theme="dark"] nav.navbar .dropdown-menu .theme-selector:focus,
html[data-theme="dark"] nav.navbar .dropdown-menu .background-selector:focus,
html[data-theme="dark"] nav.navbar .dropdown-menu #client-selector-dropdown:focus {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: #63b3ed;
    box-shadow: 0 0 0 0.2rem rgba(99, 179, 237, 0.25);
}

/* Dark Mode Dropdown Styles */
html[data-theme="dark"] .dropdown-menu {
    background-color: #343434 !important;
    border: 1px solid black !important;
}

html[data-theme="dark"] .dropdown-divider {
    border-top: 1px solid black;
}

html[data-theme="dark"] .dropdown-item {
    color: #e9ecef !important;
}

html[data-theme="dark"] .dropdown-item:hover {
    background-color: #374151;
    color: #ffffff !important;
}

html[data-theme="dark"] .dropdown-item i {
    color: #e9ecef;
}

/* Glass Mode Dropdown Styles (counterpart to the dark block above; without
   this, dropdowns fall back to the white `.dropdown-menu { ... !important }`
   base rule in glass on pages that load navigation.css but not style.css). */
html[data-theme="glass"] .dropdown-menu {
    background-color: rgba(20, 20, 35, 0.92) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}
html[data-theme="glass"] .dropdown-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}
html[data-theme="glass"] .dropdown-item {
    color: rgba(255, 255, 255, 0.9) !important;
}
html[data-theme="glass"] .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.12);
    color: #ffffff !important;
}
html[data-theme="glass"] .dropdown-item i {
    color: rgba(255, 255, 255, 0.75);
}

/* Responsive */
@media (max-width: 991.98px) {
    .navbar-collapse {
        background-color: rgba(0, 0, 0, 0.1);
        border-radius: 8px;
        margin-top: 0;
        padding: 1rem;
    }

    html[data-theme="dark"] .navbar-collapse {
        background-color: rgba(45, 55, 72, 0.9);
    }
}

/* Override legacy style.default.css margin-top on .page for pages using the new nav */
@media (max-width: 1024px) {
    .page:has(> nav.navbar) {
        margin-top: 0;
    }
}

/* Logo Styles */
.teletrack-mobile-logo-img {
    width: 120px;
    height: auto;
}

@media (max-width: 991.98px) {
    .teletrack-mobile-logo-img {
        width: 100px;
    }
}

/* Dark Mode Styles */
html[data-theme="dark"] {
    color-scheme: dark;
}

html[data-theme="dark"] body {
    background-color: #1a1a1a;
    color: #e9ecef;
}

html[data-theme="dark"] .card {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #e9ecef;
}

html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-footer {
    background-color: #2c2c2c;
    color: white;
}

html[data-theme="dark"] .card-header {
    border-bottom: 1px solid black;
}

html[data-theme="dark"] .card-body {
    background-color: #343434;
    color: #e9ecef;
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #e9ecef;
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
    background-color: #2d3748;
    border-color: #63b3ed;
    color: #e9ecef;
}

html[data-theme="dark"] .btn-primary {
    color: #ffffff !important;
}

html[data-theme="dark"] .btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
    color: #ffffff !important;
}

html[data-theme="dark"] .btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #ffffff !important;
}

html[data-theme="dark"] .btn-secondary:hover {
    background-color: #5c636a;
    border-color: #565e64;
    color: #ffffff !important;
}

html[data-theme="dark"] .table {
    color: #e9ecef;
}

html[data-theme="dark"] .table th,
html[data-theme="dark"] .table td {
    color: #e9ecef;
}

html[data-theme="dark"] .table-hover tbody tr:hover {
    background-color: #374151;
}

/* Tab Styles */
.nav-tabs .nav-link {
    color: #6c757d !important;
}

.nav-tabs .nav-link.active {
    color: #495057 !important;
    background-color: #fff !important;
    border-color: #dee2e6 #dee2e6 #fff !important;
}

html[data-theme="dark"] .nav-tabs .nav-link {
    color: #adb5bd !important;
}

html[data-theme="dark"] .nav-tabs .nav-link.active {
    color: #fff !important;
    background-color: #464f5b !important;
    border-color: #464f5b !important;
}

.tab-content {
    padding-top: 20px;
}

/* Glass Theme - Navbar */
html[data-theme="glass"] nav.navbar {
    background: rgba(255, 255, 255, 0.12) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15), inset 0 1px 2px rgba(255, 255, 255, 0.3);
}

html[data-theme="glass"] nav.navbar .dropdown-menu {
    background: rgba(15, 15, 30, 0.75) !important;
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

html[data-theme="glass"] nav.navbar .dropdown-item {
    color: rgba(255, 255, 255, 0.9) !important;
}

html[data-theme="glass"] nav.navbar .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
}

html[data-theme="glass"] nav.navbar .dropdown-item i {
    color: rgba(255, 255, 255, 0.75);
}

html[data-theme="glass"] nav.navbar .dropdown-divider {
    border-color: rgba(255, 255, 255, 0.15);
}

html[data-theme="glass"] nav.navbar .dropdown-item.active,
html[data-theme="glass"] nav.navbar .dropdown-item:active {
    background-color: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
}

html[data-theme="glass"] nav.navbar .form-select,
html[data-theme="glass"] nav.navbar .form-control {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

html[data-theme="glass"] nav.navbar .form-select option,
html[data-theme="glass"] nav.navbar .form-control option {
    background-color: #1a1a2e;
    color: #ffffff;
}

html[data-theme="glass"] nav.navbar .theme-selector {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

html[data-theme="glass"] nav.navbar .theme-selector option {
    background-color: #1a1a2e;
    color: #ffffff;
}

/* Keep the client + background selectors matching .theme-selector in glass.
   The client selector's ID-based rule otherwise out-specifies the generic
   glass .form-select styling and leaves it opaque white. */
html[data-theme="glass"] nav.navbar .dropdown-menu .theme-selector,
html[data-theme="glass"] nav.navbar .dropdown-menu .background-selector,
html[data-theme="glass"] nav.navbar .dropdown-menu #client-selector-dropdown {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

html[data-theme="glass"] nav.navbar .dropdown-menu .theme-selector option,
html[data-theme="glass"] nav.navbar .dropdown-menu .background-selector option,
html[data-theme="glass"] nav.navbar .dropdown-menu #client-selector-dropdown option {
    background-color: #1a1a2e;
    color: #ffffff;
}

html[data-theme="glass"] nav.navbar .text-muted {
    color: rgba(255, 255, 255, 0.6) !important;
}

@media (max-width: 991.98px) {
    html[data-theme="glass"] .navbar-collapse {
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 8px;
    }
}