/*
 * WebAR C-Panel & Viewer Stylesheet
 * Version: 3.5
 * Description: Added styling for the auth message text scramble effect.
 */

/* ---------------------------------- */
/* :root - THEME & FONT DEFINITIONS   */
/* ---------------------------------- */
/* IMPORTANT: To use new fonts, update your HTML font link to:
 * <link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@400;700&family=Genos:wght@100&display=swap" rel="stylesheet">
 */
:root {
    /* Color Palette */
    --color-primary: #f3ea5f; /* Neon Yellow */
    --color-secondary: #00f6ff; /* Cyan */
    --color-tertiary: #ff00f8;  /* Magenta */
    --color-danger: #ff4b4b; /* Neon Red */
    --color-bg-dark: #090a0f;
    --color-bg-med: #1a1c2a;
    --color-text: #d0d0f0;

    /* Typography */
    --font-primary: 'Orbitron', sans-serif;
    --font-secondary: 'Rajdhani', sans-serif;
    --font-scramble: 'Genos', sans-serif;

    /* --- Augmented-UI Base Configuration --- */
    --aug-border-color: var(--color-secondary);
    --aug-border-bg: transparent;
    --aug-inlay-color: var(--color-secondary);
    --aug-inlay-bg: rgba(0, 246, 255, 0.1);
    --aug-inlay-opacity: 1;
}

/* ---------------------------------- */
/* GLOBAL & BASE STYLES               */
/* ---------------------------------- */

body {
    background-color: var(--color-bg-dark);
    color: var(--color-text);
    font-family: var(--font-secondary);
    overflow: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-primary);
    text-transform: uppercase;
}

a-scene {
    height: 100vh;
    width: 100vw;
}

/* ---------------------------------- */
/* KEYFRAMES & ANIMATIONS             */
/* ---------------------------------- */

@keyframes blinker { 50% { opacity: 0; } }
.blinker { animation: blinker 1s linear infinite; }

@keyframes glitch-anim {
    0%, 100% { clip-path: inset(0 0 0 0); } 5%, 10% { clip-path: inset(0.8em 0 0.2em 0) } 15%, 20% { clip-path: inset(0.2em 0 0.8em 0) }
}

@keyframes text-shake {
    0%, 100% { transform: translate(0,0); }
    10% { transform: translate(-2px, 2px); }
    20% { transform: translate(2px, -2px); }
    30%, 80% { transform: translate(0,0); }
    81% { transform: translate(3px, -1px); opacity: 0.8; }
    82% { transform: translate(0,0); opacity: 1; }
}

@keyframes scan { from { background-position: 0 0; } to { background-position: 0 100vh; } }
@keyframes move-grid { from { background-position: 0 0; } to { background-position: 40px 40px; } }

/* Keyframe for the pulsing border glow */
@keyframes border-glow-pulse {
  0% {
    box-shadow: 0 0 20px rgba(243, 234, 95, 0.5), inset 0 0 10px 2px rgba(243, 234, 95, 0.2);
  }
  50% {
    box-shadow: 0 0 45px rgba(243, 234, 95, 0.8), inset 0 0 18px 4px rgba(243, 234, 95, 0.5);
  }
  100% {
    box-shadow: 0 0 20px rgba(243, 234, 95, 0.5), inset 0 0 10px 2px rgba(243, 234, 95, 0.2);
  }
}


/* ---------------------------------- */
/* REUSABLE CYBERPUNK COMPONENTS      */
/* ---------------------------------- */

.cyber-frame {
    position: relative;
    background: linear-gradient(145deg, rgba(26, 28, 42, 0.95), rgba(9, 10, 15, 0.95));
    --aug-border-all: 1px;
    --aug-corner-size: 20px;
}

.cyber-btn {
    font-family: var(--font-primary);
    text-transform: uppercase;
    background-color: transparent;
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    padding: 10px 20px;
    clip-path: polygon(0% 0%, 100% 0%, 100% 75%, 90% 100%, 0% 100%);
    transition: all 0.2s ease;
    cursor: pointer;
}
.cyber-btn:hover:not(:disabled), .cyber-btn.active {
    background-color: var(--color-primary);
    color: var(--color-bg-dark);
    box-shadow: 0 0 20px var(--color-primary);
}
.cyber-btn.secondary { border-color: var(--color-secondary); color: var(--color-secondary); }
.cyber-btn.secondary:hover:not(:disabled) { background-color: var(--color-secondary); box-shadow: 0 0 20px var(--color-secondary); color: var(--color-bg-dark); }
.cyber-btn.danger { border-color: var(--color-danger); color: var(--color-danger); }
.cyber-btn.danger:hover:not(:disabled) { background-color: var(--color-danger); box-shadow: 0 0 20px var(--color-danger); color: var(--color-bg-dark); }
.cyber-btn:disabled {
    border-color: #555; color: #555; background-color: transparent; cursor: not-allowed; box-shadow: none;
}

.cyber-input {
    background-color: rgba(0, 246, 255, 0.1);
    border: 1px solid var(--color-secondary);
    color: var(--color-text); padding: 10px;
    font-family: var(--font-secondary); width: 100%;
}
.cyber-input:focus {
    outline: none; box-shadow: 0 0 10px var(--color-secondary); border: 1px solid var(--color-primary);
}
.cyber-input::placeholder { color: rgba(208, 208, 240, 0.4); }

.glitch {
    animation: glitch-anim 3s infinite;
    font-family: var(--font-primary);
    text-shadow: -1px -1px 0 var(--color-tertiary), 1px 1px 0 var(--color-secondary);
}
.glitch-2 { animation: text-shake 5s infinite step-end; } /* Renamed from glitch-anim-2 */

.modal-overlay {
    position: fixed; inset: 0; width: 100%; height: 100%;
    background: rgba(9, 10, 15, 0.8);
    backdrop-filter: blur(5px);
    z-index: 100;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: opacity 0.5s ease-out;
    padding: 1rem;
    perspective: 1200px;
}
.modal-overlay.hidden { opacity: 0; pointer-events: none; }

.drop-zone {
    border: 2px dashed var(--color-secondary);
    background: rgba(0, 246, 255, 0.05);
    padding: 2rem; text-align: center; cursor: pointer;
    transition: background-color 0.3s, border-style 0.3s;
}
.drop-zone:hover { background: rgba(0, 246, 255, 0.1); border-style: solid; }


/* ---------------------------------- */
/* ADMIN & PLACEMENT CONSOLE STYLES   */
/* ---------------------------------- */
#admin-body-bg,
.placement-console-body {
    background-image: radial-gradient(circle at 1px 1px, rgba(208, 208, 240, 0.2) 1px, transparent 0), radial-gradient(circle at 10px 10px, rgba(208, 208, 240, 0.1) 1px, transparent 0);
    background-size: 20px 20px;
}

#scanline {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(20, 20, 30, 0), rgba(20, 20, 30, 0.1) 50%, rgba(20, 20, 30, 0));
    animation: scan 7s linear infinite;
    z-index: 99;
}

.cyber-h1 { font-size: 2.5rem; color: var(--color-primary); text-shadow: 0 0 10px var(--color-primary); }
.cyber-h2 { font-size: 1.5rem; color: var(--color-secondary); text-shadow: 0 0 8px var(--color-secondary); }

.nav-link {
    font-family: var(--font-primary); color: var(--color-secondary);
    border-left: 3px solid transparent; transition: all 0.3s ease; position: relative;
}
.nav-link:hover, .nav-link.active {
    color: var(--color-primary); background-color: rgba(243, 234, 95, 0.1); border-left: 3px solid var(--color-primary);
}
.nav-link:hover::before {
    content: '>>'; position: absolute; left: 10px;
    color: var(--color-primary); animation: blinker 1s linear infinite;
}

.cyber-table { width: 100%; border-collapse: collapse; }
.cyber-table thead { font-family: var(--font-primary); text-transform: uppercase; border-bottom: 2px solid var(--color-secondary); }
.cyber-table th, .cyber-table td { padding: 12px; text-align: left; border-bottom: 1px solid rgba(0, 246, 255, 0.2); }
.cyber-table tbody tr:hover { background-color: rgba(243, 234, 95, 0.05); }

.page { display: none; }
.page.active { display: block; }

/* Styles specific to placement console */
.ui-panel {
    position: fixed; top: 0; height: 100%; width: 280px; z-index: 10;
    background: linear-gradient(90deg, rgba(9, 10, 15, 0.95) 0%, rgba(9, 10, 15, 0.8) 70%, rgba(9, 10, 15, 0) 100%);
    padding: 1.5rem; color: var(--color-text);
    box-shadow: 0 0 15px rgba(0, 246, 255, 0.2);
    display: flex; flex-direction: column;
}
#left-panel { left: 0; }
#right-panel {
    right: 0; left: auto; border-right: none;
    background: linear-gradient(-90deg, rgba(9, 10, 15, 0.95) 0%, rgba(9, 10, 15, 0.8) 70%, rgba(9, 10, 15, 0) 100%);
}
#right-panel[data-augmented-ui] { --aug-border-left: 1px; --aug-border-right: 0; }
#left-panel[data-augmented-ui] { --aug-border-right: 1px; --aug-border-left: 0; }

.asset-list { list-style: none; padding: 0; margin-top: 1.5rem; flex-grow: 1; overflow-y: auto; }
.asset-item { display: flex; align-items: center; padding: 0.75rem; margin-bottom: 1rem; background-color: rgba(0, 246, 255, 0.1); border: 1px solid var(--color-secondary); cursor: grab; transition: all 0.2s ease; }
.asset-item:hover { background-color: rgba(243, 234, 95, 0.2); border-color: var(--color-primary); }
.asset-icon { width: 30px; height: 30px; margin-right: 1rem; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: var(--color-primary); }
.asset-name { font-family: var(--font-primary); font-size: 0.9rem; }
.transform-controls { margin-top: 1.5rem; color: var(--color-text); display: flex; flex-direction: column; height: 100%; }
.control-group { margin-bottom: 1rem; }
.control-group label { display: block; font-size: 0.8rem; margin-bottom: 0.25rem; color: var(--color-secondary); }
.control-group input[type="range"] { width: 100%; }


/* ---------------------------------- */
/* AR VIEWER SPECIFIC STYLES (UPDATED) */
/* ---------------------------------- */

#parallax-bg {
    position: fixed; inset: 0; z-index: 1; overflow: hidden; background-color: #02040a;
}
.parallax-layer {
    position: absolute; inset: -10%; background-position: center; background-repeat: no-repeat; background-size: cover;
    transition: transform 0.3s ease-out;
}
.parallax-layer.layer-1 { background-image: radial-gradient(ellipse at 20% 80%, rgba(243, 234, 95, 0.1) 0%, transparent 50%); }
.parallax-layer.layer-2 { background-image: radial-gradient(ellipse at 80% 20%, rgba(0, 255, 255, 0.15) 0%, transparent 40%); }
.parallax-layer.layer-3 {
    background-image: linear-gradient(rgba(243, 234, 95, 0.2) 1px, transparent 1px), linear-gradient(90deg, rgba(243, 234, 95, 0.2) 1px, transparent 1px);
    background-size: 50px 50px; animation: move-grid 15s linear infinite;
}

#header-logo { position: fixed; top: 2rem; left: 2rem; z-index: 20; width: 65px; }

.name-modal-content {
    width: 90vw; max-width: 500px;
    padding: 2rem; position: relative; overflow: hidden;
    animation: border-glow-pulse 2.5s infinite ease-in-out;
    transform: rotateX(10deg) rotateY(-5deg);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    
    /* augmented-ui properties */
    --aug-border-color: var(--color-primary);
    --aug-border-all: 2px;
    --aug-background: black;
}
.name-modal-content:hover {
    transform: rotateX(0deg) rotateY(0deg) scale(1.05);
}
.name-modal-content h2 { 
    color: var(--color-primary); 
    text-shadow: 0 0 8px var(--color-primary), 0 0 12px var(--color-primary);
}
/* Override generic cyber-input for this specific modal */
.name-modal-content .cyber-input {
    background-color: rgba(243, 234, 95, 0.05);
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    text-shadow: 0 0 5px var(--color-primary);
    font-family: var(--font-primary);
    font-weight: 900;
    text-align: center;
    font-size: 1.5rem;
}
.name-modal-content .cyber-input:focus {
    box-shadow: 0 0 15px var(--color-primary);
    border: 1px solid #fff;
}
.name-modal-content .cyber-input::placeholder {
    color: rgba(243, 234, 95, 0.4);
    font-weight: 400; /* Make placeholder text normal weight */
}
.name-modal-content .cyber-btn:hover:not(:disabled) {
    box-shadow: 0 0 25px var(--color-primary), 0 0 40px var(--color-primary);
}

/* Updated style for the greeting message */
#greeting-message {
    color: var(--color-primary);
    text-shadow: 0 0 8px var(--color-primary), 0 0 12px var(--color-primary);
    animation: text-shake 4s infinite step-end;
}

/* Style for GPS searching text scramble effect */
#loading-status, #auth-sub-message {
    font-family: var(--font-scramble);
    font-weight: 100;
    color: var(--color-secondary);
    font-size: 1.5rem;
    letter-spacing: 0.1em;
}
/* Style for main auth message */
#auth-message {
    font-family: var(--font-primary);
}


#selfie-preview-img { max-height: 60vh; object-fit: contain; display: block; margin: 0 auto; }

#advanced-hud {
    position: fixed; bottom: 1rem; left: 5%; right: 5%;
    height: 80px; z-index: 20; display: flex;
    justify-content: space-between; align-items: center;
    pointer-events: none; gap: 1rem;
}
.hud-pod {
    height: 100%; padding: 0.5rem 1.5rem;
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; pointer-events: all;
    color: var(--color-secondary);
    --aug-border-all: 1px;
    --aug-inlay-all: 1px;
    --aug-background: rgba(9, 10, 15, 0.7);
}
.hud-pod.center { flex-grow: 1; flex-direction: row; gap: 1.5rem; }

#compass {
    width: 50px; height: 50px; border: 1px solid var(--color-primary);
    border-radius: 50%; position: relative;
}
#compass-needle {
    width: 2px; height: 20px; background: var(--color-danger);
    position: absolute; left: 50%; top: 5px;
    transform-origin: bottom; transition: transform 0.2s linear;
}

#selfie-btn { background: none; border: none; padding: 0; color: var(--color-primary); transition: color 0.2s; cursor: pointer; }
#selfie-btn:hover { color: var(--color-secondary); }


/* ---------------------------------- */
/* LEAFLET MAP THEME OVERRIDES        */
/* ---------------------------------- */

.map-container, #live-map-container { z-index: 10; }
.map-container { height: 320px; }
#live-map-container { position: fixed; top: 2rem; right: 2rem; width: 200px; height: 200px; }
#map, #view-assets-map, #live-map { height: 100%; width: 100%; }

.leaflet-container { background-color: var(--color-bg-dark) !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    background: var(--color-bg-med); color: var(--color-text);
    border: 1px solid var(--color-secondary); box-shadow: 0 0 10px rgba(0,246,255,0.3);
}
.leaflet-popup-content { font-family: var(--font-primary); font-size: 14px; text-transform: uppercase; }
.leaflet-popup-close-button { color: var(--color-text) !important; }
.leaflet-control-zoom-in, .leaflet-control-zoom-out {
    background-color: var(--color-bg-med) !important; color: var(--color-primary) !important;
    border: 1px solid var(--color-secondary) !important;
}
.leaflet-control-attribution, .leaflet-control-zoom { display: none; }


/* ---------------------------------- */
/* RESPONSIVE DESIGN & MEDIA QUERIES  */
/* ---------------------------------- */

@media (max-width: 768px) {
    #advanced-hud {
        flex-direction: column; bottom: 0; left: 0; right: 0; height: auto;
    }
    .hud-pod { width: 100%; --aug-tr: 0; --aug-bl: 0; --aug-br: 0; --aug-tl: 0; }
    .hud-pod.center { margin: 0.5rem 0; }
    #live-map-container { width: 120px; height: 120px; top: 1rem; right: 1rem; }
    #header-logo { width: 65px; top: 1rem; left: 1rem; }
    .admin-main-panel { flex-direction: column; }
    .admin-nav { width: 100%; flex-shrink: 1; }
}