/* ============================================
   JARVIS HUD Interface - Futuristic Design
   ============================================ */

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

:root {
    /* Neon Color Palette */
    --neon-cyan: #00d1ff;
    --neon-blue: #0080ff;
    --neon-red: #ff0040;
    --neon-green: #00ff88;
    --neon-purple: #b300ff;
    
    /* Background Colors */
    --bg-dark: #0a0a0f;
    --bg-darker: #050508;
    --bg-overlay: rgba(0, 0, 0, 0.7);
    
    /* Glass Effect */
    --glass-bg: rgba(0, 0, 0, 0.6);
    --glass-border: rgba(0, 209, 255, 0.3);
    --glass-blur: blur(15px);
    
    /* Glow Effects */
    --glow-cyan: 0 0 20px rgba(0, 209, 255, 0.6);
    --glow-blue: 0 0 20px rgba(0, 128, 255, 0.6);
    --glow-red: 0 0 20px rgba(255, 0, 64, 0.6);
    --glow-green: 0 0 20px rgba(0, 255, 136, 0.6);
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #00d1ff;
    --text-muted: rgba(255, 255, 255, 0.6);
}

body {
    font-family: 'Orbitron', 'Exo 2', monospace;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* ============================================
   Background Grid Overlay
   ============================================ */
.grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 209, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 209, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.4;
    z-index: 1;
    animation: gridPulse 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes gridPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

/* ============================================
   Video Background
   ============================================ */
#videoFeed {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
    opacity: 0.3;
    filter: brightness(0.7) contrast(1.2);
}

/* ============================================
   Detection Canvas Overlay
   ============================================ */
#detectionCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
}

/* ============================================
   Main HUD Container
   ============================================ */
.hud-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

.hud-container > * {
    pointer-events: auto;
}

/* ============================================
   Center Scanner Reticle
   ============================================ */
.scanner-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scanner-reticle {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Rotating Rings */
.ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid var(--neon-cyan);
    box-shadow: var(--glow-cyan);
}

.ring-outer {
    width: 100%;
    height: 100%;
    border-style: dashed;
    border-width: 3px;
    animation: rotateRing 8s linear infinite;
    opacity: 0.8;
}

.ring-middle {
    width: 70%;
    height: 70%;
    border-style: solid;
    animation: rotateRing 6s linear infinite reverse;
    opacity: 0.9;
}

.ring-inner {
    width: 40%;
    height: 40%;
    border-style: solid;
    border-width: 2px;
    opacity: 1;
}

@keyframes rotateRing {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Ring Segments (Outer Ring) */
.ring-segment {
    position: absolute;
    width: 20px;
    height: 3px;
    background: var(--neon-cyan);
    box-shadow: var(--glow-cyan);
    top: -2px;
    left: 50%;
    transform-origin: 0 50%;
}

.ring-outer .ring-segment:nth-child(1) { transform: translateX(-50%) rotate(0deg); }
.ring-outer .ring-segment:nth-child(2) { transform: translateX(-50%) rotate(90deg); }
.ring-outer .ring-segment:nth-child(3) { transform: translateX(-50%) rotate(180deg); }
.ring-outer .ring-segment:nth-child(4) { transform: translateX(-50%) rotate(270deg); }

/* Ring Dots (Middle Ring) */
.ring-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--neon-cyan);
    border-radius: 50%;
    box-shadow: var(--glow-cyan);
    top: -4px;
    left: 50%;
    transform-origin: 0 50%;
}

.ring-middle .ring-dot:nth-child(1) { transform: translateX(-50%) rotate(0deg); }
.ring-middle .ring-dot:nth-child(2) { transform: translateX(-50%) rotate(90deg); }
.ring-middle .ring-dot:nth-child(3) { transform: translateX(-50%) rotate(180deg); }
.ring-middle .ring-dot:nth-child(4) { transform: translateX(-50%) rotate(270deg); }

/* Pulse Animation */
.pulse {
    animation: pulseRing 2s ease-in-out infinite;
}

@keyframes pulseRing {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
        box-shadow: var(--glow-cyan);
    }
    50% {
        transform: scale(1.1);
        opacity: 0.7;
        box-shadow: 0 0 30px rgba(0, 209, 255, 0.8);
    }
}

/* Crosshair */
.crosshair {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crosshair-line {
    position: absolute;
    background: var(--neon-cyan);
    box-shadow: var(--glow-cyan);
}

.crosshair-line.horizontal {
    width: 60%;
    height: 2px;
    left: 20%;
}

.crosshair-line.vertical {
    width: 2px;
    height: 60%;
    top: 20%;
}

.center-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--neon-cyan);
    border-radius: 50%;
    box-shadow: var(--glow-cyan);
    animation: centerPulse 1.5s ease-in-out infinite;
}

@keyframes centerPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.6; }
}

/* Scanning Text */
.scanning-text {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--neon-cyan);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: var(--glow-cyan);
    animation: textPulse 2s ease-in-out infinite;
    font-family: 'Orbitron', monospace;
}

@keyframes textPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Object Label */
.object-label {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass-bg);
    border: 2px solid var(--neon-green);
    border-radius: 8px;
    padding: 8px 16px;
    color: var(--neon-green);
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: var(--glow-green);
    backdrop-filter: var(--glass-blur);
    display: none;
    animation: labelFadeIn 0.3s ease-out;
}

.object-label.active {
    display: block;
}

@keyframes labelFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ============================================
   Panel Toggle Icons
   ============================================ */
.panel-toggle-icon {
    position: fixed;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 3px solid var(--neon-blue);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 16;
    transition: all 0.3s ease;
    backdrop-filter: var(--glass-blur);
    box-shadow: var(--glow-blue);
    padding: 0;
}

.panel-toggle-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 0 25px rgba(0, 128, 255, 0.8);
    border-color: var(--neon-blue);
}

.panel-toggle-icon.active {
    background: rgba(0, 128, 255, 0.3);
    box-shadow: 0 0 30px rgba(0, 128, 255, 0.9);
}

.toggle-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 10px var(--neon-blue));
    transition: all 0.3s ease;
}

.panel-toggle-icon:hover .toggle-icon {
    filter: drop-shadow(0 0 15px var(--neon-blue));
    transform: scale(1.1);
}

/* JARVIS AI Toggle Position */
.ai-toggle {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

/* Command Interface Toggle Position */
.console-toggle {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

/* Camera Switch Position */
.camera-switch {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

/* ============================================
   Left AI Response Panel
   ============================================ */
.ai-panel {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 350px;
    max-width: 30vw;
    max-height: 70vh;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: 10px;
    backdrop-filter: var(--glass-blur);
    box-shadow: var(--glow-cyan);
    display: flex;
    flex-direction: column;
    z-index: 15;
    overflow: hidden;
    transition: all 0.3s ease;
    opacity: 1;
    pointer-events: auto;
}

.ai-panel.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) translateX(-100px);
}

.panel-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-icon {
    font-size: 20px;
    filter: drop-shadow(0 0 8px var(--neon-cyan));
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { 
        transform: scale(1);
        filter: drop-shadow(0 0 8px var(--neon-cyan));
    }
    50% { 
        transform: scale(1.1);
        filter: drop-shadow(0 0 15px var(--neon-cyan));
    }
}

.panel-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--text-secondary);
    font-family: 'Orbitron', monospace;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--neon-green);
    border-radius: 50%;
    box-shadow: var(--glow-green);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-size: 11px;
    color: var(--neon-green);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: 'Orbitron', monospace;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    font-size: 13px;
    line-height: 1.8;
}

.ai-response {
    min-height: 100px;
}

.response-line {
    margin-bottom: 12px;
    color: var(--text-primary);
    opacity: 0;
    animation: typeIn 0.5s ease-out forwards;
}

.response-line:nth-child(1) { animation-delay: 0.1s; }
.response-line:nth-child(2) { animation-delay: 0.3s; }
.response-line:nth-child(3) { animation-delay: 0.5s; }
.response-line:nth-child(4) { animation-delay: 0.7s; }
.response-line:nth-child(5) { animation-delay: 0.9s; }

@keyframes typeIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================
   Bottom Command Console
   ============================================ */
.command-console {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    max-width: 90vw;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: 10px;
    backdrop-filter: var(--glass-blur);
    box-shadow: var(--glow-cyan);
    z-index: 15;
    overflow: hidden;
    transition: all 0.3s ease;
    opacity: 1;
    pointer-events: auto;
}

.command-console.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(100px);
}

.console-header {
    padding: 12px 20px;
    border-bottom: 1px solid var(--glass-border);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--text-secondary);
    font-family: 'Orbitron', monospace;
    display: flex;
    align-items: center;
}

.console-title-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.console-icon {
    font-size: 16px;
    filter: drop-shadow(0 0 6px var(--neon-cyan));
}

.console-input-container {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    align-items: center;
}

.console-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 5px;
    padding: 12px 15px;
    color: var(--text-primary);
    font-family: 'Exo 2', monospace;
    font-size: 13px;
    outline: none;
    transition: all 0.3s ease;
}

.console-input:focus {
    border-color: var(--neon-cyan);
    box-shadow: var(--glow-cyan);
}

.mic-button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 2px solid var(--neon-cyan);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: var(--glow-cyan);
}

.mic-button:hover {
    transform: scale(1.1);
    box-shadow: 0 0 25px rgba(0, 209, 255, 0.8);
}

.mic-button.listening {
    border-color: var(--neon-red);
    box-shadow: var(--glow-red);
    animation: micPulse 1s ease-in-out infinite;
}

@keyframes micPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.mic-icon {
    font-size: 20px;
    z-index: 2;
    filter: drop-shadow(0 0 5px var(--neon-cyan));
}

.mic-button.listening .mic-icon {
    filter: drop-shadow(0 0 5px var(--neon-red));
}

.mic-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(0, 209, 255, 0.3);
    animation: pulseRing 2s ease-out infinite;
}

.send-button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(0, 209, 255, 0.2);
    border: 2px solid var(--neon-cyan);
    color: var(--neon-cyan);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    box-shadow: var(--glow-cyan);
    padding: 0;
}

.send-icon {
    filter: drop-shadow(0 0 5px var(--neon-cyan));
}

.send-button:hover {
    background: rgba(0, 209, 255, 0.4);
    transform: scale(1.1);
}

.send-button:hover .send-icon {
    filter: drop-shadow(0 0 10px var(--neon-cyan));
}

.command-history {
    max-height: 150px;
    overflow-y: auto;
    padding: 10px 20px;
    font-size: 11px;
    border-top: 1px solid var(--glass-border);
}

.command-entry {
    margin-bottom: 8px;
    padding: 6px 0;
    border-left: 2px solid var(--neon-cyan);
    padding-left: 10px;
    color: var(--text-muted);
    animation: slideInUp 0.3s ease-out;
}

.command-entry.user {
    border-left-color: var(--neon-blue);
    color: var(--neon-blue);
}

.command-entry.ai {
    border-left-color: var(--neon-green);
    color: var(--neon-green);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Loading Overlay
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-darker);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

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

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--neon-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-text {
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 10px;
    font-family: 'Orbitron', monospace;
}

.loading-status {
    color: var(--text-muted);
    font-size: 12px;
    font-family: 'Exo 2', monospace;
}

/* ============================================
   Scrollbar Styling
   ============================================ */
.panel-content::-webkit-scrollbar,
.command-history::-webkit-scrollbar {
    width: 6px;
}

.panel-content::-webkit-scrollbar-track,
.command-history::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

.panel-content::-webkit-scrollbar-thumb,
.command-history::-webkit-scrollbar-thumb {
    background: var(--neon-cyan);
    border-radius: 3px;
}

.panel-content::-webkit-scrollbar-thumb:hover,
.command-history::-webkit-scrollbar-thumb:hover {
    background: var(--neon-blue);
}

/* ============================================
   Scan Overlay Animation
   ============================================ */
@keyframes scanFade {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@keyframes rotateIcon {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1024px) {
    .scanner-container {
        width: 300px;
        height: 300px;
    }
    
    .ai-panel {
        width: 280px;
        max-width: 35vw;
    }
    
    .command-console {
        width: 500px;
    }
}

@media (max-width: 768px) {
    .scanner-container {
        width: 250px;
        height: 250px;
    }
    
    .scanning-text {
        font-size: 12px;
        top: -50px;
    }
    
    .object-label {
        font-size: 14px;
        bottom: -40px;
    }
    
    .ai-toggle {
        left: 10px;
        width: 50px;
        height: 50px;
    }

    .toggle-icon {
        font-size: 24px;
    }

    .ai-panel {
        left: 10px;
        width: calc(100vw - 280px);
        max-width: none;
        top: 20px;
        transform: none;
        max-height: calc(50vh - 20px);
    }

    .ai-panel.hidden {
        transform: translateX(-100px);
    }
    
    .console-toggle {
        bottom: 10px;
        width: 50px;
        height: 50px;
    }

    .camera-switch {
        right: 10px;
        width: 50px;
        height: 50px;
    }

    .command-console {
        width: calc(100vw - 20px);
        bottom: 10px;
    }

    .command-console.hidden {
        transform: translateX(-50%) translateY(100px);
    }
    
    .ring-outer {
        border-width: 2px;
    }
    
    .ring-middle {
        border-width: 2px;
    }
}

@media (max-width: 480px) {
    .scanner-container {
        width: 200px;
        height: 200px;
    }
    
    .scanning-text {
        font-size: 10px;
        top: -40px;
        letter-spacing: 2px;
    }
    
    .object-label {
        font-size: 12px;
        padding: 6px 12px;
        bottom: -35px;
    }
    
    .ai-toggle {
        left: 5px;
        width: 45px;
        height: 45px;
    }

    .console-toggle {
        bottom: 5px;
        width: 45px;
        height: 45px;
    }

    .camera-switch {
        right: 5px;
        width: 45px;
        height: 45px;
    }

    .toggle-icon {
        font-size: 20px;
    }

    .ai-panel {
        left: 5px;
        width: calc(100vw - 10px);
        top: 10px;
        max-height: calc(40vh - 10px);
    }

    .ai-panel.hidden {
        transform: translateX(-100px);
    }
    
    .panel-header {
        padding: 10px 15px;
    }
    
    .panel-title {
        font-size: 11px;
    }
    
    .panel-content {
        padding: 15px;
        font-size: 11px;
    }
    
    .command-console {
        width: calc(100vw - 10px);
        bottom: 5px;
    }
    
    .console-input-container {
        padding: 10px 15px;
        gap: 8px;
    }
    
    .mic-button,
    .send-button {
        width: 40px;
        height: 40px;
    }
    
    .mic-icon {
        font-size: 18px;
    }
}

/* Landscape Orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .scanner-container {
        width: 200px;
        height: 200px;
    }
    
    .ai-panel {
        top: 10px;
        max-height: calc(60vh - 10px);
    }
    
    .command-console {
        bottom: 10px;
    }
}

