/* Jetfolio - Global Styles */
/* Warm Professional Design System - iOS 26 Flat Style */

:root {
    /* ===== WARM PROFESSIONAL COLOR SYSTEM ===== */

    /* Primary - Warm Brown (Headers, CTAs, Accents) */
    --primary-color: #8b7355;
    --warm-accent: #8b7355;
    --warm-accent-light: #a0917d;
    --warm-accent-dark: #6d5a42;

    /* Secondary - Gold Tones */
    --secondary-color: #c9a96e;
    --gold: #c9a96e;
    --gold-light: #d9c08e;
    --gold-dark: #a88c4e;

    /* Contrast - Dark Navy (Aviation Feel, Icons) */
    --contrast-navy: #1e3a5f;
    --icon-color: #1e3a5f;
    --icon-secondary: #3d5a80;

    /* Navy Accent - Charts, Data Visualization, Links on Light Backgrounds */
    --navy-accent: #3a506b;         /* Classic warm navy - primary chart color */
    --navy-accent-light: #5a708b;   /* Lighter variant for hover/fills */
    --navy-accent-dark: #2a3a4b;    /* Darker variant for emphasis */

    /* Legacy Navy Aliases (for backward compatibility) */
    --primary-navy: #8b7355;
    --primary-navy-light: #a0917d;
    --primary-navy-dark: #6d5a42;

    /* Legacy Sky Blue Aliases (map to warm tones) */
    --sky-blue: #a0917d;
    --sky-blue-light: #b5a898;
    --sky-blue-dark: #8b7355;

    /* Legacy Accent Aliases */
    --accent-purple: #8b7355;
    --primary-purple: #6d5a42;

    /* Warm Background System */
    --bg-primary: #faf8f5;
    --bg-secondary: #f5f3f0;
    --bg-card: #ffffff;
    --bg-card-alt: #faf7f2;         /* Light warm cream - replaces grey card backgrounds */
    --bg-elevated: #ffffff;
    --warm-bg: #faf8f5;
    --warm-card: #ffffff;
    --warm-subtle: #f5f3f0;

    /* Warm Border System */
    --warm-border: #f0ebe3;
    --warm-divider: #ece7df;
    --border-default: #f0ebe3;
    --border-subtle: #ece7df;
    --border-strong: #ddd5c9;

    /* Standard Gradients (warm versions) */
    --gradient-warm: linear-gradient(135deg, #8b7355 0%, #a0917d 100%);
    --gradient-warm-subtle: linear-gradient(135deg, rgba(139,115,85,0.08) 0%, rgba(160,145,125,0.05) 100%);
    --gradient-navy: linear-gradient(135deg, #8b7355 0%, #a0917d 100%);
    --gradient-sky: linear-gradient(135deg, #a0917d 0%, #b5a898 100%);
    --gradient-success: linear-gradient(135deg, var(--success-green-dark) 0%, var(--success-green) 100%);
    --gradient-danger: linear-gradient(135deg, var(--danger-red-dark) 0%, var(--danger-red) 100%);

    /* Success - Green (Compliance & Safety) */
    --success-color: #22c55e;
    --success-green: #22c55e;
    --success-green-light: #4ade80;
    --success-green-dark: #16a34a;
    --success-bg: #f0fdf4;
    --success-text: #16a34a;

    /* Warning - Amber (Attention Required) */
    --warning-color: #f59e0b;
    --warning-yellow: #f59e0b;
    --warning-amber: #f59e0b;
    --warning-bg: #fffbeb;
    --warning-text: #d97706;

    /* Danger - Red (Critical Issues) */
    --danger-color: #ef4444;
    --danger-red: #ef4444;
    --danger-red-dark: #dc2626;
    --danger-bg: #fef2f2;
    --danger-text: #dc2626;

    /* Info - Warm Brown (matching our design system) */
    --info-color: var(--warm-accent);
    --info-bg: var(--warm-subtle);
    --info-text: var(--warm-accent-dark);

    /* Text Colors - Warm Charcoal (Updated for WCAG AA Contrast) */
    --text-primary: #2c2c2c;
    --text-secondary: #5a4a3a;      /* Dark warm brown - readable on light backgrounds */
    --text-muted: #7a6a5a;          /* Medium warm brown - readable muted text */
    --text-on-light: #4a3728;       /* NEW: For labels on light cream backgrounds */
    --text-inverse: #ffffff;

    /* Grayscale */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    --spacing-3xl: 4rem;

    /* Border Radius - iOS 26 Larger, Liquid Feel */
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 18px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* Shadows - Minimal, Warm-Tinted (iOS 26 Flat Style) */
    --shadow-none: none;
    --shadow-xs: 0 1px 2px rgba(139, 115, 85, 0.04);
    --shadow-sm: 0 1px 3px rgba(139, 115, 85, 0.06);
    --shadow-md: 0 2px 8px rgba(139, 115, 85, 0.08);
    --shadow-lg: 0 4px 16px rgba(139, 115, 85, 0.10);
    --shadow-xl: 0 8px 24px rgba(139, 115, 85, 0.12);
    --shadow-inner: inset 0 2px 4px 0 rgba(139, 115, 85, 0.04);
    --shadow-card: 0 2px 12px rgba(139, 115, 85, 0.08);

    /* Z-Index Scale (for consistent layering) */
    --z-base: 1;
    --z-dropdown: 100;
    --z-sticky: 500;
    --z-header: 600;
    --z-modal-backdrop: 1000;
    --z-modal: 1001;
    --z-toast: 2000;
    --z-tooltip: 3000;

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', SFMono-Regular, ui-monospace, Menlo, Monaco, monospace;

    /* Touch Targets (Apple/Google Guidelines) */
    --touch-target-min: 44px;
    --touch-target-comfortable: 48px;
    --touch-target-large: 56px;

    /* Transitions - iOS 26 Smooth */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;

    /* Legacy FRMS Aliases (map purple/blue to warm theme) */
    --purple: var(--warm-accent);
    --purple-light: var(--warm-accent-light);
    --purple-dark: var(--warm-accent-dark);
    --accent-blue: var(--warm-accent);

    /* Risk Level Color System (4 distinct levels) */
    --risk-low: #22c55e;
    --risk-low-bg: rgba(34, 197, 94, 0.15);
    --risk-moderate: #eab308;
    --risk-moderate-bg: rgba(234, 179, 8, 0.15);
    --risk-high: #f97316;
    --risk-high-bg: rgba(249, 115, 22, 0.15);
    --risk-critical: #ef4444;
    --risk-critical-bg: rgba(239, 68, 68, 0.15);
}

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

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

/* Skip to Content (Accessibility) */
.skip-to-content {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--warm-accent);
    color: var(--text-inverse);
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    font-weight: 600;
    border-radius: 0 0 var(--radius-md) 0;
    z-index: var(--z-tooltip);
    transition: top var(--transition-normal);
}

.skip-to-content:focus {
    top: 0;
    outline: 3px solid var(--warm-accent-light);
    outline-offset: 2px;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-lg);
}

/* Cards - iOS 26 Flat Style */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    border: 1px solid var(--warm-border);
    transition: all var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.card-header {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--contrast-navy);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--warm-border);
    position: relative;
}

.card-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: var(--warm-accent);
    transition: width var(--transition-normal);
}

.card:hover .card-header::after {
    width: 100px;
}

/* ============================================
   BUTTON SYSTEM - iOS 26 Flat Style
   Base + Types + Sizes + Styles
   ============================================ */

/* Base Button */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    min-height: var(--touch-target-min);
    line-height: 1;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Button Types (Semantic Colors) - Flat Style */
.btn-primary {
    background: var(--warm-accent);
    color: var(--text-inverse);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background: var(--warm-accent-dark);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--warm-accent-light);
    color: var(--text-inverse);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--warm-accent);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--success-green);
    color: var(--text-inverse);
    box-shadow: var(--shadow-sm);
}

.btn-success:hover:not(:disabled) {
    background: var(--success-green-dark);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: var(--danger-red);
    color: var(--text-inverse);
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger-red-dark);
    box-shadow: var(--shadow-md);
}

/* Button Styles (Visual Variants) */
.btn-outline {
    background: transparent;
    border: 1.5px solid var(--warm-accent);
    color: var(--warm-accent);
    box-shadow: none;
}

.btn-outline:hover:not(:disabled) {
    background: var(--warm-accent);
    color: var(--text-inverse);
}

.btn-outline.btn-secondary {
    border-color: var(--warm-accent-light);
    color: var(--warm-accent-light);
}

.btn-outline.btn-secondary:hover:not(:disabled) {
    background: var(--warm-accent-light);
    color: var(--text-inverse);
}

.btn-outline.btn-success {
    border-color: var(--success-green);
    color: var(--success-green);
}

.btn-outline.btn-success:hover:not(:disabled) {
    background: var(--success-green);
    color: var(--text-inverse);
}

.btn-outline.btn-danger {
    border-color: var(--danger-red);
    color: var(--danger-red);
}

.btn-outline.btn-danger:hover:not(:disabled) {
    background: var(--danger-red);
    color: var(--text-inverse);
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--warm-accent);
    box-shadow: none;
}

.btn-ghost:hover:not(:disabled) {
    background: rgba(139, 115, 85, 0.1);
}

.btn-ghost.btn-secondary {
    color: var(--warm-accent-light);
}

.btn-ghost.btn-secondary:hover:not(:disabled) {
    background: rgba(160, 145, 125, 0.1);
}

/* Button Sizes */
.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
    min-height: 36px;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    min-height: 56px;
}

/* Button Layout */
.btn-block {
    width: 100%;
    justify-content: center;
}

/* Button with Icon */
.btn svg {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}

/* Form Elements */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-sm);
    color: var(--gray-600);
    font-weight: 500;
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
}

.form-control:hover {
    border-color: var(--warm-accent-light);
}

.form-control:focus {
    outline: none;
    border-color: var(--warm-accent);
    box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.1);
}

select.form-control {
    cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    margin-right: var(--spacing-sm);
    accent-color: var(--warm-accent, #8b7355);
    cursor: pointer;
}

input[type="checkbox"]:focus,
input[type="radio"]:focus {
    outline: 2px solid var(--warm-accent-light);
    outline-offset: 2px;
}

/* Autocomplete */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    z-index: var(--z-dropdown);
    display: none;
}

.autocomplete-item {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.2s;
}

.autocomplete-item:hover {
    background-color: var(--warm-subtle);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item div:first-child {
    font-weight: 600;
    color: var(--gray-900);
}

.autocomplete-item div:last-child {
    font-size: 0.8125rem;
    color: var(--gray-600);
    margin-top: 0.125rem;
}

/* Grid */
.grid {
    display: grid;
    gap: var(--spacing-lg);
}

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1024px) {
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }
}

/* Utilities */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-success {
    color: var(--success-green);
}

.text-danger {
    color: var(--danger-red);
}

.text-warning {
    color: var(--warning-yellow);
}

.bg-success {
    background-color: var(--success-bg);
}

.bg-danger {
    background-color: var(--danger-bg);
}

.bg-warning {
    background-color: var(--warning-bg);
}

/* Status Messages */
.alert {
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-lg);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-green-light);
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger-red);
}

.alert-info {
    background: var(--info-bg);
    color: var(--info-text);
    border: 1px solid var(--info-color);
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   FOCUS-VISIBLE STYLES (ACCESSIBILITY)
   Enhanced keyboard navigation visual feedback
   ============================================ */

/* Remove default focus outline, use focus-visible instead */
*:focus {
    outline: none;
}

/* Focus-visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--warm-accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Button focus-visible */
.btn:focus-visible {
    outline: 2px solid var(--warm-accent);
    outline-offset: 3px;
    box-shadow: 0 0 0 4px rgba(139, 115, 85, 0.15);
}

/* Form control focus-visible */
.form-control:focus-visible {
    outline: 2px solid var(--warm-accent);
    outline-offset: 2px;
    border-color: var(--warm-accent);
}

/* Link focus-visible */
a:focus-visible {
    outline: 2px solid var(--warm-accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Card focus-visible */
.card:focus-visible,
.tool-card:focus-visible {
    outline: 2px solid var(--warm-accent);
    outline-offset: 3px;
    box-shadow: 0 0 0 4px rgba(139, 115, 85, 0.15);
}

/* Navigation items focus-visible */
.nav-item:focus-visible,
.nav-dropdown-item:focus-visible,
.user-dropdown-item:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
    background: rgba(255, 255, 255, 0.25);
}

/* Modal close button focus-visible */
.modal-close:focus-visible {
    outline: 2px solid var(--warm-accent);
    outline-offset: 2px;
    background: rgba(139, 115, 85, 0.1);
}

/* Skip to content focus-visible - already has :focus styles */
.skip-to-content:focus-visible {
    outline: 2px solid var(--warm-accent-light);
    outline-offset: 2px;
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: var(--spacing-md);
    }

    .card {
        padding: var(--spacing-lg);
    }
}
