/**
 * Threshold Brands Design System
 * Provides consistent styling across the FMS portal
 */

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
    /* Primary Brand Colors */
    --threshold-navy: #051B35;
    --threshold-navy-light: #0a2d4d;
    --threshold-navy-dark: #031020;
    --threshold-yellow: #FFCF09;
    --threshold-yellow-light: #FFE066;
    --threshold-yellow-dark: #E6B800;

    /* Neutral Palette */
    --zee-gray-50: #F8FAFC;
    --zee-gray-100: #F1F5F9;
    --zee-gray-200: #E2E8F0;
    --zee-gray-300: #CBD5E1;
    --zee-gray-400: #94A3B8;
    --zee-gray-500: #64748B;
    --zee-gray-600: #475569;
    --zee-gray-700: #334155;
    --zee-gray-800: #1E293B;
    --zee-gray-900: #0F172A;

    /* Semantic Colors */
    --zee-success: #10B981;
    --zee-success-light: #D1FAE5;
    --zee-warning: #F59E0B;
    --zee-warning-light: #FEF3C7;
    --zee-danger: #EF4444;
    --zee-danger-light: #FEE2E2;
    --zee-info: #3B82F6;
    --zee-info-light: #DBEAFE;

    /* Design Tokens */
    --zee-border-radius: 10px;
    --zee-border-radius-sm: 6px;
    --zee-border-radius-lg: 12px;
    --zee-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --zee-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --zee-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --zee-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --zee-transition: all 0.2s ease;
}

/* ============================================
   Header / Topbar Styling
   ============================================ */
#page-topbar {
    background: linear-gradient(135deg, var(--threshold-navy) 0%, var(--threshold-navy-light) 100%) !important;
    box-shadow: none;
    border-bottom: none !important;
}

/* Horizontal navigation bar below topbar */
.topnav {
    background: var(--threshold-navy) !important;
    border-top: none !important;
    border-bottom: none !important;
    box-shadow: var(--zee-shadow-md);
}

/* Remove ALL borders between topbar and nav */
#page-topbar,
#page-topbar::after,
.navbar-header,
.navbar-header::after,
.topnav,
.topnav::before,
.topnav::after,
[data-layout="horizontal"] .navbar-menu,
[data-layout="horizontal"] .navbar-menu::before {
    border-top: none !important;
    border-bottom: none !important;
}

/* Override any box-shadow that might appear as a line */
#page-topbar {
    box-shadow: none !important;
}

/* Ensure clean transition between topbar and nav */
.navbar-menu {
    border-top: none !important;
    margin-top: 0 !important;
}

.navbar-header {
    padding: 0 1rem;
}

/* Logo adjustments */
.navbar-brand-box.horizontal-logo {
    background: transparent !important;
}

.navbar-brand-box .logo-light {
    display: block !important;
}

.navbar-brand-box .logo-dark {
    display: none !important;
}

/* Hamburger menu icon */
.topnav-hamburger .hamburger-icon span {
    background-color: white !important;
}

.topnav-hamburger:hover .hamburger-icon span {
    background-color: var(--threshold-yellow) !important;
}

/* Current Office Badge */
.header-item .badge.bg-light {
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white !important;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 50px;
}

.header-item .badge.bg-light span {
    color: white !important;
}

.header-item .badge.bg-light b {
    color: var(--threshold-yellow) !important;
}

/* Header buttons/icons */
.btn-topbar.btn-ghost-secondary {
    color: rgba(255, 255, 255, 0.85) !important;
    background: transparent !important;
    border: none;
}

.btn-topbar.btn-ghost-secondary:hover,
.btn-topbar.btn-ghost-secondary:focus {
    color: var(--threshold-yellow) !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

.btn-topbar.btn-ghost-secondary .position-absolute.topbar-badge {
    background: var(--threshold-yellow) !important;
    color: var(--threshold-navy) !important;
    font-weight: 700;
}

/* User dropdown in header */
.topbar-user {
    background: transparent !important;
}

.topbar-user .btn {
    color: white !important;
    background: transparent !important;
}

.topbar-user .btn:hover,
.topbar-user .btn:focus {
    background: rgba(255, 255, 255, 0.1) !important;
}

.topbar-user .user-name-text {
    color: white !important;
}

.topbar-user .user-name-sub-text {
    color: rgba(255, 255, 255, 0.7) !important;
}

.topbar-user .header-profile-user {
    border: 2px solid var(--threshold-yellow);
}

/* Fix header item backgrounds */
.header-item {
    background: transparent !important;
}

/* ============================================
   Horizontal Layout Nav Menu Fix
   ============================================ */
/* In horizontal layout, the navbar-menu should be below the topbar */
[data-layout="horizontal"] .navbar-menu {
    top: 70px !important;
    z-index: 1000 !important;
}

/* Mobile sidebar - when opened via hamburger menu, sidebar needs higher z-index than overlay */
@media (max-width: 1024px) {
    [data-layout="horizontal"] .vertical-sidebar-enable .navbar-menu,
    .vertical-sidebar-enable .navbar-menu {
        z-index: 1055 !important;
    }
}

/* Horizontal nav dropdown menus - make them solid and readable */
[data-layout="horizontal"] .navbar-nav .dropdown-menu,
[data-layout="horizontal"] .navbar-menu .dropdown-menu,
.topnav .dropdown-menu,
.navbar-menu .menu-dropdown {
    background: var(--threshold-navy) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: var(--zee-shadow-lg) !important;
    backdrop-filter: none !important;
    opacity: 1 !important;
}

/* Dropdown menu items in horizontal nav */
[data-layout="horizontal"] .navbar-nav .dropdown-menu .dropdown-item,
[data-layout="horizontal"] .navbar-menu .dropdown-menu a,
.topnav .dropdown-menu .dropdown-item,
.navbar-menu .menu-dropdown .nav-link {
    color: rgba(255, 255, 255, 0.85) !important;
    background: transparent !important;
    padding: 0.625rem 1.25rem;
}

[data-layout="horizontal"] .navbar-nav .dropdown-menu .dropdown-item:hover,
[data-layout="horizontal"] .navbar-menu .dropdown-menu a:hover,
.topnav .dropdown-menu .dropdown-item:hover,
.navbar-menu .menu-dropdown .nav-link:hover {
    color: white !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

[data-layout="horizontal"] .navbar-nav .dropdown-menu .dropdown-item.active,
[data-layout="horizontal"] .navbar-menu .dropdown-menu a.active,
.navbar-menu .menu-dropdown .nav-link.active {
    color: var(--threshold-navy) !important;
    background: var(--threshold-yellow) !important;
}

/* ============================================
   Sidebar Styling
   ============================================ */
.app-menu.navbar-menu {
    background: var(--threshold-navy) !important;
    border-right: none;
    box-shadow: var(--zee-shadow-lg);
}

/* Sidebar logo area */
.app-menu .navbar-brand-box {
    background: var(--threshold-navy-dark) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.app-menu .navbar-brand-box .logo-light {
    display: block !important;
}

.app-menu .navbar-brand-box .logo-dark {
    display: none !important;
}

/* Sidebar menu title */
.app-menu .menu-title span {
    color: var(--threshold-yellow) !important;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.6875rem;
    letter-spacing: 0.08em;
}

/* Sidebar nav links */
.app-menu .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.8) !important;
    padding: 0.625rem 1.25rem;
    margin: 0.125rem 0.5rem;
    border-radius: var(--zee-border-radius-sm);
    transition: var(--zee-transition);
    font-size: 0.875rem;
}

.app-menu .navbar-nav .nav-link:hover {
    color: white !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

.app-menu .navbar-nav .nav-link.active {
    color: var(--threshold-navy) !important;
    background: var(--threshold-yellow) !important;
    font-weight: 600;
}

/* Sidebar nav link icons */
.app-menu .navbar-nav .nav-link i {
    color: var(--threshold-yellow);
    font-size: 1.125rem;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.app-menu .navbar-nav .nav-link:hover i,
.app-menu .navbar-nav .nav-link.active i {
    color: inherit;
}

/* Dropdown menus in sidebar */
.app-menu .menu-dropdown {
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--zee-border-radius-sm);
    margin: 0.25rem 0.5rem;
    padding: 0.25rem 0;
}

.app-menu .menu-dropdown .nav-link {
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    font-size: 0.8125rem;
    margin: 0;
    border-radius: 0;
}

.app-menu .menu-dropdown .nav-link:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

/* Badges in sidebar */
.app-menu .badge {
    font-size: 0.6875rem;
    padding: 0.25rem 0.5rem;
    border-radius: 50px;
}

.app-menu .badge.bg-danger {
    background: var(--zee-danger) !important;
}

.app-menu .badge.bg-warning {
    background: var(--threshold-yellow) !important;
    color: var(--threshold-navy) !important;
}

.app-menu .badge.bg-primary {
    background: var(--zee-info) !important;
}

/* Collapse toggle arrow */
.app-menu .nav-link[data-bs-toggle="collapse"]::after {
    color: rgba(255, 255, 255, 0.5);
}

/* Sidebar scrollbar */
.app-menu #scrollbar::-webkit-scrollbar {
    width: 4px;
}

.app-menu #scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.app-menu #scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.app-menu #scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Sidebar background pattern/overlay */
.app-menu .sidebar-background {
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.1) 100%);
}

/* Vertical hover button */
.app-menu #vertical-hover {
    color: rgba(255, 255, 255, 0.5) !important;
}

.app-menu #vertical-hover:hover {
    color: var(--threshold-yellow) !important;
}

/* ============================================
   Main Content Area
   ============================================ */
.main-content {
    background: var(--zee-gray-50);
}

.page-content {
    padding: 1.5rem;
}

/* ============================================
   Page Headers (dark background headers)
   ============================================ */
.page-header {
    background: linear-gradient(135deg, var(--threshold-navy) 0%, var(--threshold-navy-light) 100%);
    border-radius: var(--zee-border-radius);
    padding: 1.75rem 2rem;
    margin-bottom: 1.5rem;
    color: white;
    box-shadow: var(--zee-shadow-md);
}

.page-header h1,
.page-header h2,
.page-header h3,
.page-header h4,
.page-header h5,
.page-header h6 {
    color: white !important;
}

.page-header p {
    color: rgba(255, 255, 255, 0.85);
    margin: 0.5rem 0 0;
}

.page-header i {
    color: var(--threshold-yellow);
}

/* ============================================
   Dropdown Menus
   ============================================ */
.dropdown-menu {
    border-radius: var(--zee-border-radius);
    border: 1px solid var(--zee-gray-200);
    box-shadow: var(--zee-shadow-lg);
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: var(--zee-border-radius-sm);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--zee-gray-700);
    transition: var(--zee-transition);
}

.dropdown-item:hover {
    background: var(--zee-gray-100);
    color: var(--threshold-navy);
}

.dropdown-item i {
    color: var(--zee-gray-500);
}

.dropdown-item:hover i {
    color: var(--threshold-navy);
}

.dropdown-header {
    color: var(--threshold-navy);
    font-weight: 600;
    padding: 0.5rem 1rem;
}

.dropdown-divider {
    border-color: var(--zee-gray-200);
    margin: 0.5rem 0;
}

/* ============================================
   Alert Messages
   ============================================ */
.alert {
    border-radius: var(--zee-border-radius);
    border: none;
    padding: 1rem 1.25rem;
}

.alert-success {
    background: var(--zee-success-light);
    color: #065F46;
    border-left: 4px solid var(--zee-success);
}

.alert-danger {
    background: var(--zee-danger-light);
    color: #991B1B;
    border-left: 4px solid var(--zee-danger);
}

.alert-warning {
    background: var(--zee-warning-light);
    color: #92400E;
    border-left: 4px solid var(--zee-warning);
}

.alert-info {
    background: var(--zee-info-light);
    color: #1E40AF;
    border-left: 4px solid var(--zee-info);
}

/* ============================================
   Cards
   ============================================ */
.card {
    border-radius: var(--zee-border-radius);
    border: 1px solid var(--zee-gray-200);
    box-shadow: var(--zee-shadow);
    background: white;
}

.card-header {
    background: var(--zee-gray-50);
    border-bottom: 1px solid var(--zee-gray-200);
    padding: 1rem 1.25rem;
}

.card-title {
    color: var(--threshold-navy);
    font-weight: 600;
    margin: 0;
}

.card-body {
    padding: 1.25rem;
}

/* ============================================
   Buttons
   ============================================ */
.btn-primary {
    background: var(--threshold-navy) !important;
    border-color: var(--threshold-navy) !important;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--threshold-navy-light) !important;
    border-color: var(--threshold-navy-light) !important;
}

.btn-warning {
    background: var(--threshold-yellow) !important;
    border-color: var(--threshold-yellow) !important;
    color: var(--threshold-navy) !important;
}

.btn-warning:hover,
.btn-warning:focus {
    background: var(--threshold-yellow-dark) !important;
    border-color: var(--threshold-yellow-dark) !important;
    color: var(--threshold-navy) !important;
}

.btn-outline-primary {
    color: var(--threshold-navy) !important;
    border-color: var(--threshold-navy) !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background: var(--threshold-navy) !important;
    color: white !important;
}

.btn-check:checked + .btn-outline-primary,
.btn-check:active + .btn-outline-primary,
.btn-outline-primary.active,
.btn-outline-primary:active {
    background: var(--threshold-navy) !important;
    color: white !important;
    border-color: var(--threshold-navy) !important;
}

/* ============================================
   Tables
   ============================================ */
.table thead th {
    background: var(--zee-gray-50);
    color: var(--zee-gray-700);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.6875rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--zee-gray-200);
    padding: 0.875rem 1rem;
}

.table tbody td {
    color: var(--zee-gray-700);
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--zee-gray-100);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: var(--zee-gray-50);
}

/* ============================================
   Forms
   ============================================ */
.form-control,
.form-select {
    border-radius: var(--zee-border-radius-sm);
    border: 1px solid var(--zee-gray-300);
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    transition: var(--zee-transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--threshold-navy);
    box-shadow: 0 0 0 3px rgba(5, 27, 53, 0.1);
}

.form-label {
    color: var(--zee-gray-700);
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.375rem;
}

/* ============================================
   Badges
   ============================================ */
.badge.bg-primary {
    background: var(--threshold-navy) !important;
}

.badge.bg-warning {
    background: var(--threshold-yellow) !important;
    color: var(--threshold-navy) !important;
}

.badge.bg-success {
    background: var(--zee-success) !important;
}

.badge.bg-danger {
    background: var(--zee-danger) !important;
}

.badge.bg-info {
    background: var(--zee-info) !important;
}

/* ============================================
   Mobile Responsive Adjustments
   ============================================ */
@media (max-width: 991.98px) {
    /* Mobile sidebar overlay */
    .vertical-overlay {
        background: rgba(5, 27, 53, 0.5);
    }

    /* Mobile header adjustments */
    #page-topbar {
        padding: 0;
    }

    .navbar-header {
        padding: 0 0.75rem;
    }

    /* Hide some elements on mobile */
    .header-item .badge.bg-light span:first-child {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .page-content {
        padding: 1rem;
    }

    /* Compact header badge on mobile */
    .header-item .badge.bg-light {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
    }
}

/* ============================================
   Footer
   ============================================ */
.footer {
    background: white;
    border-top: 1px solid var(--zee-gray-200);
    color: var(--zee-gray-500);
    font-size: 0.8125rem;
}

/* ============================================
   Utility Classes
   ============================================ */
.text-threshold-navy {
    color: var(--threshold-navy) !important;
}

.text-threshold-yellow {
    color: var(--threshold-yellow) !important;
}

.bg-threshold-navy {
    background-color: var(--threshold-navy) !important;
}

.bg-threshold-yellow {
    background-color: var(--threshold-yellow) !important;
}

.border-threshold-navy {
    border-color: var(--threshold-navy) !important;
}

.border-threshold-yellow {
    border-color: var(--threshold-yellow) !important;
}
