/* ==========================================================================
   Apex Sentinel Suite - Enterprise Cyber Operations Theme & Luxury UI
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
    --color-bg-primary: #020617;
    --color-bg-surface: #0f172a;
    --color-border-subtle: #1e293b;
    --color-accent-cyan: #06b6d4;
    --color-accent-indigo: #6366f1;
    --color-status-success: #10b981;
    --color-status-danger: #f43f5e;
    --color-status-warning: #f59e0b;
}

/* Global Font & Antialiasing */
html, body {
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Monospace restricted strictly to Code, IPs, Hashes & LTR numbers */
.font-mono, code, pre, time {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
    letter-spacing: -0.01em;
}

/* Fix Arabic ligatures: Never apply letter-spacing to Arabic */
[dir="rtl"] {
    letter-spacing: normal !important;
}

[dir="rtl"] span:not(.font-mono),
[dir="rtl"] p,
[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3,
[dir="rtl"] h4,
[dir="rtl"] div:not(.font-mono),
[dir="rtl"] button:not(.fa),
[dir="rtl"] a,
[dir="rtl"] label {
    font-family: 'Cairo', system-ui, sans-serif;
    letter-spacing: 0 !important;
}

/* Ensure FontAwesome Icons maintain their icon glyphs */
.fa, .fa-solid, .fa-regular, .fa-brands, [class*="fa-"] {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
    letter-spacing: normal !important;
    font-style: normal !important;
}

/* Enforce single-line text on all buttons, badges, nav and toolbar links (anti-wrapping) */
button, .btn, a.btn, nav a, header a, [role="button"], .btn-nowrap {
    white-space: nowrap !important;
    flex-shrink: 0;
}

/* Custom Smooth Scrollbar for SOC Audit Feeds & Tables */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(2, 6, 23, 0.7);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
    transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: #06b6d4;
}

/* Cyber Card Micro-interactions */
.cyber-card {
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.cyber-card:hover {
    border-color: rgba(6, 182, 212, 0.35);
    box-shadow: 0 4px 20px -2px rgba(6, 182, 212, 0.08);
}

/* Pulse Glowing Effects for Threat & Isolation Indicators */
@keyframes cyberGlowPulse {
    0%, 100% {
        box-shadow: 0 0 12px rgba(244, 63, 94, 0.4);
    }
    50% {
        box-shadow: 0 0 24px rgba(244, 63, 94, 0.8);
    }
}

.glow-isolated {
    animation: cyberGlowPulse 2s infinite ease-in-out;
}

/* Hide scrollbar for clean horizontal action toolbars */
.no-scrollbar::-webkit-scrollbar {
    display: none;
    height: 0;
    width: 0;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Remote Desktop Floating Toolbar Transitions & States */
#rdpFloatingToolbar {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, max-height 0.3s ease;
}

.rdp-toolbar-collapsed {
    transform: translateY(-120%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

.rdp-toolbar-docked-bottom #rdpFloatingToolbar.rdp-toolbar-collapsed {
    transform: translateY(120%) !important;
}

.rdp-toolbar-docked-bottom #rdpToolbarToggleBtn {
    border-top-width: 1px;
    border-bottom-width: 0;
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    margin-top: 0;
    margin-bottom: -0.25rem;
}

/* Remote Desktop Modern Header & Dropdown Architecture */
.rdp-dropdown-container {
    position: relative;
    display: inline-flex;
}

.rdp-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    z-index: 100;
    min-width: 220px;
    background: rgba(15, 23, 42, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(56, 189, 248, 0.25);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    border-radius: 0.75rem;
    padding: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    transform-origin: top;
    animation: rdpDropdownIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.rdp-dropdown-menu.hidden {
    display: none !important;
}

@keyframes rdpDropdownIn {
    from {
        opacity: 0;
        transform: translateY(-4px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.rdp-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.45rem 0.65rem;
    font-size: 0.75rem;
    line-height: 1rem;
    border-radius: 0.5rem;
    color: #cbd5e1;
    background: transparent;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: start;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.rdp-dropdown-item:hover {
    background: rgba(30, 41, 59, 0.8);
    color: #ffffff;
}

.rdp-dropdown-item:active {
    transform: scale(0.99);
}

.rdp-dropdown-item kbd {
    font-size: 0.65rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 600;
    color: #94a3b8;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(71, 85, 105, 0.6);
    padding: 0.1rem 0.35rem;
    border-radius: 0.25rem;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.rdp-dropdown-divider {
    height: 1px;
    background: rgba(51, 65, 85, 0.7);
    margin: 0.25rem 0.2rem;
}

/* Dashboard Top Navigation Dropdown Architecture */
.nav-dropdown-container {
    position: relative;
    display: inline-flex;
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    z-index: 100;
    min-width: 275px;
    max-width: calc(100vw - 1.5rem);
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(56, 189, 248, 0.25);
    box-shadow: 0 25px 35px -5px rgba(0, 0, 0, 0.7), 0 10px 15px -6px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    border-radius: 0.85rem;
    padding: 0.45rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    transform-origin: top;
    animation: navDropdownIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

[dir="rtl"] .nav-dropdown-menu {
    right: 0;
    left: auto;
}

[dir="ltr"] .nav-dropdown-menu {
    left: 0;
    right: auto;
}

.nav-dropdown-menu.hidden {
    display: none !important;
}

#navOperationsMenuBtn i.fa-chevron-down {
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-menu-active i.fa-chevron-down {
    transform: rotate(180deg);
}

@keyframes navDropdownIn {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    font-size: 0.75rem;
    line-height: 1.1rem;
    font-weight: 600;
    border-radius: 0.6rem;
    color: #cbd5e1;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    width: 100%;
    text-align: start;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.nav-dropdown-item:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
}

.nav-dropdown-item:active {
    transform: scale(0.99);
}

.nav-dropdown-divider {
    height: 1px;
    background: rgba(51, 65, 85, 0.7);
    margin: 0.3rem 0.25rem;
}

/* Light mode support for nav dropdown */
html.light .nav-dropdown-menu {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(203, 213, 225, 0.9);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

html.light .nav-dropdown-item {
    color: #334155;
}

html.light .nav-dropdown-item:hover {
    background: #f1f5f9;
    color: #0f172a;
}

html.light .nav-dropdown-divider {
    background: #e2e8f0;
}

/* ==========================================================================
   EXECUTIVE LIGHT MODE THEME (Tailwind Overrides & High-Contrast Visuals)
   ========================================================================== */
html.light,
body.light {
    color-scheme: light;
}

html.light body,
body.light,
html.light .bg-slate-950,
html.light [class*="bg-slate-950"]:not(.fixed) {
    background-color: #f1f5f9 !important; /* Slate 100 */
    color: #0f172a !important; /* Slate 900 */
}

/* Card Containers & Panels */
html.light .bg-slate-900,
html.light [class*="bg-slate-900"]:not(header):not(nav):not(.fixed) {
    background-color: #ffffff !important;
    color: #1e293b !important;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.04) !important;
}

/* Header & Navigation */
html.light header[class*="bg-slate-900"],
html.light nav[class*="bg-slate-900"],
html.light header.bg-slate-900\/80,
html.light header {
    background-color: rgba(255, 255, 255, 0.92) !important;
    backdrop-filter: blur(12px) !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

/* Modal Backdrops & Dialogs */
html.light .fixed.inset-0 {
    background-color: rgba(15, 23, 42, 0.65) !important;
    backdrop-filter: blur(8px) !important;
}

html.light .fixed.inset-0 .bg-slate-900,
html.light .fixed.inset-0 [class*="bg-slate-900"] {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
}

/* Borders & Dividers */
html.light .border-slate-800,
html.light [class*="border-slate-800"],
html.light .border-slate-700,
html.light [class*="border-slate-700"] {
    border-color: #e2e8f0 !important; /* Slate 200 */
}

html.light [class*="divide-slate-800"] > :not([hidden]) ~ :not([hidden]),
html.light .divide-slate-800\/60 > :not([hidden]) ~ :not([hidden]) {
    border-color: #f1f5f9 !important;
}

/* High-Contrast Typography */
html.light .text-white,
html.light .text-slate-100,
html.light .text-slate-200 {
    color: #0f172a !important; /* Slate 900 */
}

html.light .text-slate-300,
html.light .text-slate-400 {
    color: #334155 !important; /* Slate 700 */
}

html.light .text-slate-500 {
    color: #64748b !important; /* Slate 500 */
}

/* High-Contrast Status & Brand Accents */
html.light .text-cyan-400,
html.light .text-cyan-300 {
    color: #0284c7 !important; /* Deep Cyan / Sky 600 */
}

html.light .text-emerald-400,
html.light .text-emerald-300 {
    color: #059669 !important; /* Emerald 600 */
}

html.light .text-indigo-400,
html.light .text-indigo-300 {
    color: #4338ca !important; /* Indigo 700 */
}

html.light .text-amber-400,
html.light .text-amber-300 {
    color: #b45309 !important; /* Amber 700 */
}

html.light .text-rose-400,
html.light .text-rose-300 {
    color: #be123c !important; /* Rose 700 */
}

/* Interactive Inputs & Controls */
html.light input,
html.light select,
html.light textarea {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

html.light input:focus,
html.light select:focus,
html.light textarea:focus {
    border-color: #0284c7 !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 1px #0284c7 !important;
}

html.light input::placeholder,
html.light textarea::placeholder {
    color: #94a3b8 !important;
}

/* Buttons & Badges */
html.light .bg-slate-800,
html.light [class*="bg-slate-800"] {
    background-color: #e2e8f0 !important;
    color: #1e293b !important;
}

html.light .hover\:bg-slate-700:hover,
html.light .hover\:bg-slate-800:hover,
html.light [class*="hover:bg-slate-700"]:hover,
html.light [class*="hover:bg-slate-800"]:hover {
    background-color: #cbd5e1 !important;
    color: #0f172a !important;
}

html.light .hover\:bg-slate-950\/40:hover,
html.light .hover\:bg-slate-800\/30:hover {
    background-color: #f1f5f9 !important;
}

/* Data Tables */
html.light thead.bg-slate-950,
html.light thead {
    background-color: #f8fafc !important;
    color: #475569 !important;
    border-bottom: 2px solid #e2e8f0 !important;
}

html.light thead th {
    color: #475569 !important;
}

html.light tbody tr:hover {
    background-color: #f8fafc !important;
}

html.light tbody td {
    color: #1e293b !important;
}

/* Navigation Tabs */
html.light .tab-btn.border-cyan-500 {
    border-color: #0284c7 !important;
    color: #0284c7 !important;
}

html.light .tab-btn:not(.border-cyan-500) {
    color: #64748b !important;
}

html.light .tab-btn:not(.border-cyan-500):hover {
    color: #0f172a !important;
}

/* Scrollbars */
html.light ::-webkit-scrollbar-track {
    background: #f1f5f9;
}

html.light ::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}

html.light ::-webkit-scrollbar-thumb:hover {
    background: #0284c7;
}
