* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: var(--bg-secondary);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 2rem;
    color: var(--text-tertiary);
    padding: 0 0.5rem;
}

.logo-icon {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

/* Fort Sentrix Brand - Military Crosshair O - Stacked Layout */
.brand-name {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1.1;
}

.brand-name .fort-text {
    display: inline-flex;
    align-items: center;
    font-size: 1.1em;
}

.brand-name .crosshair-o {
    position: relative;
    display: inline-block;
    width: 1.1em;
    height: 1.1em;
    margin: 0 0.02em;
    vertical-align: middle;
}

/* The O circle */
.brand-name .crosshair-o::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0.55em;
    height: 0.55em;
    border: 2px solid currentColor;
    border-radius: 50%;
    background: transparent;
}

/* Crosshair lines - extending through the O with gap in center */
.brand-name .crosshair-o::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1.1em;
    height: 1.1em;
    background:
        /* Top line - extends inside O */
        linear-gradient(currentColor, currentColor) center 0% / 2px 40% no-repeat,
        /* Bottom line - extends inside O */
        linear-gradient(currentColor, currentColor) center 100% / 2px 40% no-repeat,
        /* Left line - extends inside O */
        linear-gradient(currentColor, currentColor) 0% center / 40% 2px no-repeat,
        /* Right line - extends inside O */
        linear-gradient(currentColor, currentColor) 100% center / 40% 2px no-repeat;
}

/* Sentrix part styling - below FORT */
.brand-name .sentrix {
    color: var(--accent-color, #22d3ee);
    font-size: 0.75em;
    letter-spacing: 2px;
    margin-top: 2px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
}

.nav-item {
    padding: 0.9rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--accent-color);
}

.nav-item.active {
    background: var(--bg-tertiary);
    color: var(--accent-color);
    border-left: 4px solid var(--accent-color);
    padding-left: calc(1rem - 4px);
}

/* Phase 6: Focus styles for keyboard navigation accessibility */
.nav-item:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: -2px;
    border-radius: 0.5rem;
}

.nav-bottom {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Real-time update animations */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.pulse-animation {
    animation: pulse 0.5s ease-in-out;
}

/* ============================================================================
   PHASE 6: THEME TOGGLE BUTTON
   ============================================================================ */

.theme-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
}

.theme-toggle:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Focus styles for theme toggle button (accessibility) */
#themeToggleBtn:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
    border-radius: 0.5rem;
}

/* ============================================================================
   PHASE 61: MOBILE RESPONSIVENESS
   ============================================================================ */

/* Mobile hamburger menu button */
.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 28px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.hamburger-menu span {
    width: 100%;
    height: 3px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile header bar */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1rem;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
}

.mobile-header .logo {
    margin-bottom: 0;
    font-size: 1rem;
}

.mobile-header .logo-icon {
    width: 36px;
    height: 36px;
}

/* Mobile sidebar overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ============================================================================
   TABLET BREAKPOINT (768px - 1024px)
   ============================================================================ */
@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
        padding: 1rem;
    }

    .nav-item {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    .logo {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .logo-icon {
        width: 40px;
        height: 40px;
    }
}

/* ============================================================================
   MOBILE BREAKPOINT (max-width: 768px)
   ============================================================================ */
@media (max-width: 768px) {
    /* Show mobile header and hamburger */
    .mobile-header {
        display: flex;
    }

    .hamburger-menu {
        display: flex;
    }

    /* Hide desktop sidebar, show as slide-in on mobile */
    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        padding-top: 60px;
    }

    .sidebar.mobile-open {
        left: 0;
    }

    /* Adjust main content for mobile header */
    .container {
        flex-direction: column;
    }

    .main-content {
        margin-top: 60px;
        margin-left: 0;
        width: 100%;
        height: calc(100vh - 60px);
    }

    /* Navigation items stack better on mobile */
    .nav-item {
        padding: 1rem;
        font-size: 1rem;
    }

    .nav-item.active {
        border-left: 4px solid var(--accent-color);
        padding-left: calc(1rem - 4px);
    }

    /* Hide logo in sidebar since it's in mobile header */
    .sidebar .logo {
        display: none;
    }
}

/* ============================================================================
   SMALL MOBILE BREAKPOINT (max-width: 480px)
   ============================================================================ */
@media (max-width: 480px) {
    .mobile-header {
        padding: 0 0.75rem;
    }

    .mobile-header .logo {
        font-size: 0.9rem;
    }

    .mobile-header .logo-icon {
        width: 30px;
        height: 30px;
    }

    .sidebar {
        width: 260px;
        left: -260px;
    }

    .nav-item {
        padding: 0.85rem;
        font-size: 0.95rem;
    }
}

/* ============================================================================
   PHASE 61: WCAG AA ACCESSIBILITY ENHANCEMENTS
   ============================================================================ */

/* Skip to main content link (hidden until focused) */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent-color);
    color: white;
    padding: 8px 16px;
    z-index: 10000;
    text-decoration: none;
    font-weight: 600;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
}

/* Enhanced focus indicators for all interactive elements */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Focus within for container elements */
.nav-item:focus-within {
    background: var(--bg-tertiary);
}

/* High contrast focus for buttons */
button:focus-visible {
    box-shadow: 0 0 0 3px var(--accent-color), 0 0 0 5px var(--bg-primary);
}

/* Ensure minimum touch target size (44x44px) for mobile */
@media (max-width: 768px) {
    .nav-item,
    button,
    .hamburger-menu,
    [role="button"],
    a {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Screen reader only class - visually hidden but accessible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Make sr-only content visible when focused (for skip links etc.) */
.sr-only-focusable:focus,
.sr-only-focusable:active {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Reduced motion preference - disable animations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .pulse-animation {
        animation: none;
    }

    .sidebar,
    .sidebar-overlay,
    .hamburger-menu span {
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000;
    }

    .nav-item.active {
        border-left-width: 6px;
        font-weight: 700;
    }

    button,
    .nav-item,
    input,
    select {
        border: 2px solid currentColor;
    }

    a:focus-visible,
    button:focus-visible {
        outline-width: 4px;
    }
}

/* Ensure text is readable - minimum contrast ratios */
/* These use CSS custom properties that should be defined in themes */
.text-muted {
    /* Ensure 4.5:1 contrast ratio for WCAG AA */
    color: var(--text-secondary);
}

/* Form validation states with accessible colors */
.input-error {
    border-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.05);
}

.input-success {
    border-color: #28a745;
    background-color: rgba(40, 167, 69, 0.05);
}

/* Error messages styling */
.error-message {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Live region for announcements */
[aria-live] {
    /* Ensure live regions are not visually hidden unless intended */
}

.visually-hidden-live {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus trap indicator for modals */
.modal-open {
    overflow: hidden;
}

/* Keyboard focus indicator enhancement */
*:focus {
    outline-color: var(--accent-color);
}

/* Remove default focus outline only when using mouse */
:focus:not(:focus-visible) {
    outline: none;
}

/* Ensure adequate line height for readability */
p, li, td, th {
    line-height: 1.5;
}

/* Link styling - underline for clarity */
a:not(.nav-item):not(.btn) {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

a:not(.nav-item):not(.btn):hover {
    text-decoration-thickness: 2px;
}

