/* Mech Cockpit Theme - Industrial, Combat, HUD */
@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Teko:wght@300;400;500;600;700&display=swap');

:root {
  /* Fonts - Technical & Industrial */
  --font-mech-ui: 'Share Tech Mono', monospace;
  --font-mech-display: 'Teko', sans-serif;
  --font-sans: var(--font-mech-ui); /* Override default sans */

  /* Base Colors - Dark Metal, Graphite */
  --color-bg-primary: #111316; /* Deep Cockpit Dark */
  --color-bg-secondary: #1a1c21; /* Dark Metal */
  --color-bg-tertiary: #23272e; /* Lighter Panel */
  --color-bg-header: rgba(17, 19, 22, 0.95);

  /* Text Colors - HUD Backlight */
  --color-text-primary: #a3d8f4; /* Pale Neon Blue */
  --color-text-secondary: #5da5cc; /* Dimmed Blue */
  --color-text-muted: #3a5a70; /* Low Viz Blue */

  /* Border Colors - Steel & Bezel */
  --color-border: #4a5a6a;
  --color-border-light: rgba(74, 90, 106, 0.5);
  --color-border-medium: #35414d;

  /* Accent Colors - Combat Indicators */
  --color-accent-primary: #00ccff; /* Neon Blue HUD */
  --color-accent-secondary: #ff9900; /* Overheat Orange */
  --color-accent-blue: #00ccff;
  --color-accent-green: #00ff33; /* System Health */
  --color-accent-red: #ff3333; /* Damage/Critical */
  --color-accent-yellow: #ffcc00;
  --color-accent-amber: #ff9900;

  /* Steam Colors - HUD Integrated */
  --color-steam-bg: #1a1c21;
  --color-steam-hover: #23272e;
  --color-steam-text: #a3d8f4;
  --color-steam-border: #4a5a6a;

  /* Glass Effect - Tempered Glass */
  --glass-bg: rgba(26, 28, 33, 0.85);
  --glass-border: rgba(74, 90, 106, 0.6);
  
  /* Theme Specific */
  --mech-corner-size: 10px;
}

/* Global Styles */
body {
    font-family: var(--font-mech-ui) !important;
    background-color: var(--color-bg-primary) !important;
    color: var(--color-text-primary) !important;
    /* Industrial Grid Pattern Background */
    background-image: 
        linear-gradient(rgba(17, 19, 22, 0.9), rgba(17, 19, 22, 0.9)),
        linear-gradient(0deg, transparent 24%, rgba(74, 90, 106, .1) 25%, rgba(74, 90, 106, .1) 26%, transparent 27%, transparent 74%, rgba(74, 90, 106, .1) 75%, rgba(74, 90, 106, .1) 76%, transparent 77%, transparent),
        linear-gradient(90deg, transparent 24%, rgba(74, 90, 106, .1) 25%, rgba(74, 90, 106, .1) 26%, transparent 27%, transparent 74%, rgba(74, 90, 106, .1) 75%, rgba(74, 90, 106, .1) 76%, transparent 77%, transparent) !important;
    background-size: 50px 50px !important;
}

/* Typography Overrides */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-mech-display) !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-accent-primary) !important;
    text-shadow: 0 0 5px rgba(0, 204, 255, 0.3);
}

/* Headings with Bezel decoration */
h1 {
    border-left: 4px solid var(--color-accent-secondary);
    padding-left: 1rem;
    background: linear-gradient(90deg, rgba(255, 153, 0, 0.1), transparent);
}

/* Buttons - Panel Style */
button, .btn, a.btn-primary, a.btn-secondary {
    font-family: var(--font-mech-display) !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 0 !important;
    clip-path: polygon(
        0 0, 
        100% 0, 
        100% calc(100% - var(--mech-corner-size)), 
        calc(100% - var(--mech-corner-size)) 100%, 
        0 100%, 
        0 var(--mech-corner-size)
    );
    border: 1px solid var(--color-border) !important;
    transition: all 0.2s ease !important;
    position: relative;
}

/* Primary Button - System Action */
.btn-primary, .bg-accent-primary, .bg-purple-600 {
    background-color: rgba(0, 204, 255, 0.1) !important;
    border: 1px solid var(--color-accent-primary) !important;
    color: var(--color-accent-primary) !important;
    box-shadow: inset 0 0 10px rgba(0, 204, 255, 0.2);
}

.btn-primary:hover, .bg-accent-primary:hover, .bg-purple-600:hover {
    background-color: var(--color-accent-primary) !important;
    color: #000 !important;
    box-shadow: 0 0 15px rgba(0, 204, 255, 0.6);
}

/* Warning/Danger Buttons */
.btn-danger, .bg-red-600 {
    border-color: var(--color-accent-red) !important;
    color: var(--color-accent-red) !important;
    background-color: rgba(255, 51, 51, 0.1) !important;
}

.btn-danger:hover {
    background-color: var(--color-accent-red) !important;
    color: #000 !important;
    box-shadow: 0 0 15px rgba(255, 51, 51, 0.6);
}

/* Inputs - Data Entry Fields */
input, textarea, select {
    background-color: rgba(17, 19, 22, 0.8) !important;
    border: 1px solid var(--color-border) !important;
    border-left: 3px solid var(--color-border) !important;
    color: var(--color-text-primary) !important;
    font-family: var(--font-mech-ui) !important;
    border-radius: 0 !important;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--color-accent-primary) !important;
    border-left-color: var(--color-accent-secondary) !important;
    box-shadow: inset 0 0 10px rgba(0, 204, 255, 0.1) !important;
    outline: none !important;
}

/* Cards & Panels */
.card, .bg-bg-secondary, .bg-bg-tertiary, .bg-[#1a1a1a], .bg-[#2d2d2d], .rounded-xl, .rounded-lg {
    border-radius: 0 !important;
    border: 1px solid var(--color-border);
    position: relative;
    background-color: rgba(26, 28, 33, 0.9) !important;
    /* Corner markers */
    background-image: 
        linear-gradient(var(--color-border) 2px, transparent 2px),
        linear-gradient(var(--color-border) 2px, transparent 2px),
        linear-gradient(var(--color-border) 2px, transparent 2px),
        linear-gradient(var(--color-border) 2px, transparent 2px);
    background-position: top left, top right, bottom left, bottom right;
    background-size: 10px 10px;
    background-repeat: no-repeat;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.5);
}

/* Header - Cockpit Top Panel */
header, nav, .bg-bg-header {
    background-color: var(--color-bg-header) !important;
    border-bottom: 2px solid var(--color-border) !important;
    border-image: linear-gradient(90deg, var(--color-bg-header) 0%, var(--color-accent-primary) 50%, var(--color-bg-header) 100%) 1 !important;
}

/* Navigation Items */
nav a {
    text-transform: uppercase;
    letter-spacing: 1px;
}

nav a:hover, .nav-link:hover {
    color: var(--color-accent-primary) !important;
    text-shadow: 0 0 5px var(--color-accent-primary);
}

/* Scrollbar - Hydraulic Piston Look */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #000;
    border-left: 1px solid var(--color-border);
}
::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border: 1px solid #000;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-accent-secondary);
}

/* Specific Component Overrides */
.text-gradient {
    background: none !important;
    -webkit-text-fill-color: var(--color-accent-primary) !important;
    text-shadow: 0 0 10px rgba(0, 204, 255, 0.4);
}

/* Badges/Tags */
.badge, .tag {
    background: transparent !important;
    border: 1px solid var(--color-accent-primary);
    color: var(--color-accent-primary) !important;
    font-family: var(--font-mech-ui);
    text-transform: uppercase;
}

/* =========================================
   Animations & Dynamic Effects
   ========================================= */

@keyframes mech-scanline-scroll {
    0% { background-position: 0 0; }
    100% { background-position: 0 100%; }
}

@keyframes mech-hud-flicker {
    0% { opacity: 0.95; }
    3% { opacity: 0.8; }
    6% { opacity: 0.95; }
    7% { opacity: 0.95; }
    8% { opacity: 0.4; }
    9% { opacity: 0.95; }
    100% { opacity: 0.95; }
}

@keyframes mech-panel-boot {
    0% { 
        clip-path: polygon(0 0, 0 0, 0 100%, 0 100%);
        opacity: 0;
    }
    100% { 
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
        opacity: 1;
    }
}

@keyframes mech-glitch-skew {
    0% { transform: skew(0deg); }
    20% { transform: skew(-2deg); }
    40% { transform: skew(2deg); }
    60% { transform: skew(-1deg); }
    80% { transform: skew(1deg); }
    100% { transform: skew(0deg); }
}

@keyframes mech-pulse-border {
    0% { box-shadow: 0 0 0 0 rgba(0, 204, 255, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(0, 204, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 204, 255, 0); }
}

@keyframes mech-target-lock {
    0% { border-color: var(--color-border); }
    50% { border-color: var(--color-accent-red); box-shadow: 0 0 10px var(--color-accent-red); }
    100% { border-color: var(--color-border); }
}

/* 1. Enhanced Scanline Animation */
body::before {
    content: " ";
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%);
    background-size: 100% 4px;
    z-index: 9998;
    pointer-events: none;
    animation: mech-scanline-scroll 10s linear infinite;
    opacity: 0.5;
}

/* 2. HUD Overlay Effect (Subtle Vignette) */
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: radial-gradient(circle at center, transparent 60%, rgba(0, 0, 0, 0.4) 100%);
    z-index: 9999;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.5);
    animation: mech-hud-flicker 4s infinite;
}

/* 3. Panel Entry Animation */
/* Applies to main structural cards */
.card, .bg-bg-secondary, .bg-bg-tertiary {
    animation: mech-panel-boot 0.4s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

/* 4. Interactive Elements */
.btn-primary:hover, .bg-accent-primary:hover {
    animation: mech-glitch-skew 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

.btn-primary:active {
    animation: mech-pulse-border 0.5s ease-out;
}

/* 5. Navigation Hover - Data Stream Effect */
nav a:hover {
    position: relative;
}

nav a:hover::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--color-accent-primary);
    box-shadow: 0 0 5px var(--color-accent-primary);
    animation: mech-panel-boot 0.2s ease-out;
}

/* 6. Input Focus - Systems Engaged */
input:focus, textarea:focus, select:focus {
    animation: mech-pulse-border 1s infinite;
}

/* 7. Critical Status Blinking */
.text-red-500, .bg-red-500, .text-error, .alert-error {
    animation: mech-hud-flicker 2s infinite reverse;
}

/* Restore Font Awesome families overridden by theme typography */
.fa, .fas, .fa-solid, .far, .fa-regular {
    font-family: "Font Awesome 6 Free" !important;
}
.fab, .fa-brands {
    font-family: "Font Awesome 6 Brands" !important;
}

/* =========================================
   Mobile Performance Optimizations
   ========================================= */
@media (max-width: 768px) {
    /* Disable scanline and HUD overlay on mobile */
    body::before,
    body::after {
        display: none;
    }

    /* Simplify background */
    body {
        background-image: linear-gradient(rgba(17, 19, 22, 0.9), rgba(17, 19, 22, 0.9));
        background-size: 100% 100%;
    }

    /* Simplify card styling */
    .card, .bg-bg-secondary, .bg-bg-tertiary,
    .bg-[#1a1a1a], .bg-[#2d2d2d], .rounded-xl, .rounded-lg {
        background-image: none;
        border-radius: 4px;
    }

    /* Disable complex animations */
    .card, .bg-bg-secondary, .bg-bg-tertiary {
        animation: none;
    }

    .btn-primary:hover, .bg-accent-primary:hover,
    .bg-purple-600:hover {
        animation: none;
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 204, 255, 0.3);
    }

    .btn-primary:active {
        animation: none;
    }

    nav a:hover::after {
        animation: none;
    }

    input:focus, textarea:focus, select:focus {
        animation: none;
    }

    .text-red-500, .bg-red-500, .text-error, .alert-error {
        animation: none;
    }

    /* Simplify button clips */
    button, .btn, a.btn-primary, a.btn-secondary {
        clip-path: none;
        border-radius: 4px;
    }
}
