:root {
    --bg-color: #050914;
    --app-bg: #0a0f1d;
    --primary: #ff0000;
    --primary-glow: rgba(0, 255, 204, 0.4);
    --secondary: #0088ff;
    --alert: #ff3366;
    --alert-glow: rgba(255, 51, 102, 0.5);
    --text-main: #e0e6ed;
    --text-muted: #738299;
    --border: rgba(0, 255, 204, 0.2);
    --font-sans: 'Inter', sans-serif;
    --font-mono: 'Share Tech Mono', monospace;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-sans);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
}

/* Device Mockup wrapper (if viewed on desktop) */
#device-mockup {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #111a2e 0%, #050914 100%);
}

@media (min-width: 600px) {
    #device-mockup {
        padding: 20px;
    }

    #app-container {
        width: 375px !important;
        height: 812px !important;
        border-radius: 40px;
        border: 8px solid #1a2235;
        box-shadow: 0 0 50px rgba(0, 255, 204, 0.1), inset 0 0 20px rgba(0, 0, 0, 0.5);
        position: relative;
    }

    /* Fake notch */
    #app-container::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 120px;
        height: 25px;
        background: #1a2235;
        border-bottom-left-radius: 15px;
        border-bottom-right-radius: 15px;
        z-index: 1000;
    }
}

#app-container {
    width: 100%;
    height: 100%;
    background-color: var(--app-bg);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: opacity 0.5s ease, transform 0.5s ease;
    z-index: 10;
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom, 20px);
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.05);
    z-index: 1;
}

.screen.active {
    opacity: 1;
    pointer-events: all;
    transform: scale(1);
    z-index: 10;
}

/* --- SCREEN 1: INPUT --- */
#screen-input {
    padding: 40px 24px;
    justify-content: space-between;
    background:
        radial-gradient(circle at 50% 0%, rgba(0, 255, 204, 0.05) 0%, transparent 40%),
        linear-gradient(to bottom, transparent, rgba(0, 136, 255, 0.05));
}

.header {
    text-align: center;
    margin-top: 40px;
}

.logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo-icon {
    color: var(--primary);
    filter: drop-shadow(0 0 10px var(--primary-glow));
    animation: float 4s ease-in-out infinite;
}

.logo h1 {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: 2px;
    color: #fff;
    margin: 0;
}

.logo h1 span {
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
}

.subtitle {
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.form-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: -20px;
}

.form-container label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.input-wrapper {
    position: relative;
}

.input-wrapper .icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
}

input[type="tel"],
input[type="email"],
input[type="password"] {
    width: 100%;
    background: rgba(0, 255, 204, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 15px 18px 50px;
    font-size: 22px;
    color: #fff;
    font-family: var(--font-mono);
    outline: none;
    transition: all 0.3s ease;
    letter-spacing: 2px;
}

input[type="tel"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary-glow);
    background: rgba(0, 255, 204, 0.08);
}

input[type="tel"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder {
    color: rgba(115, 130, 153, 0.4);
}

button {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: #000;
    border: none;
    border-radius: 12px;
    padding: 18px;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 1px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    font-family: var(--font-sans);
}

button:disabled {
    background: #1a2333;
    color: #4a5a75;
    cursor: not-allowed;
    box-shadow: none;
}

button:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 255, 204, 0.2);
}

.btn-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, transparent 60%);
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

button:not(:disabled):active .btn-glow {
    opacity: 0.4;
    transform: scale(1);
    transition: 0s;
}

.footer-info {
    text-align: center;
    margin-bottom: 20px;
}

.footer-info p {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 15px;
    line-height: 1.4;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--primary);
    background: rgba(0, 255, 204, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(0, 255, 204, 0.2);
}

.dot {
    width: 6px;
    height: 6px;
    background-color: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--primary);
}

.dot.blinking {
    animation: blink 1.5s infinite;
}

/* --- SCREEN 2: SEARCHING --- */
#screen-searching {
    background-color: #030610;
    display: flex;
    flex-direction: column;
}

.radar-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 50vh;
}

.radar {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    border: 2px solid rgba(0, 255, 204, 0.3);
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 255, 204, 0.1) inset;
    background: radial-gradient(circle at center, rgba(0, 255, 204, 0.05) 0%, transparent 70%);
}

.grid-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(0, 255, 204, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 204, 0.1) 1px, transparent 1px);
    background-size: 30px 30px;
    background-position: center center;
    border-radius: 50%;
}

.radar .ring-1,
.radar .ring-2 {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px dashed rgba(0, 255, 204, 0.2);
}

.radar .ring-1 {
    width: 100px;
    height: 100px;
}

.radar .ring-2 {
    width: 200px;
    height: 200px;
}

.radar .sweep {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150px;
    height: 150px;
    transform-origin: 0 0;
    background: conic-gradient(from 0deg, transparent 70%, rgba(0, 255, 204, 0.8) 100%);
    animation: sweep 2s linear infinite;
}

@keyframes sweep {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.target-marker {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: var(--alert);
    border-radius: 50%;
    box-shadow: 0 0 15px var(--alert);
    transform: translate(-50%, -50%);
    top: 30%;
    left: 60%;
    opacity: 0;
}

.target-marker.found {
    animation: popTarget 3s forwards;
}

@keyframes popTarget {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }

    10% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.5);
    }

    20% {
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.target-marker::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--alert);
    animation: targetWave 1.5s infinite;
}

@keyframes targetWave {
    0% {
        width: 12px;
        height: 12px;
        opacity: 1;
    }

    100% {
        width: 50px;
        height: 50px;
        opacity: 0;
    }
}

.terminal-container {
    height: 180px;
    background: rgba(0, 0, 0, 0.5);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.terminal-header {
    background: rgba(0, 255, 204, 0.1);
    padding: 8px 15px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--primary);
    border-bottom: 1px solid rgba(0, 255, 204, 0.2);
}

.terminal-body {
    flex: 1;
    padding: 10px 15px;
    overflow-y: hidden;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.log-line {
    opacity: 0;
    animation: fadeIn 0.2s forwards;
}

.log-line .time {
    color: var(--text-muted);
    margin-right: 8px;
}

.log-line.success {
    color: var(--primary);
}

.log-line.warn {
    color: #ffaa00;
}

.log-line.error {
    color: var(--alert);
}

.progress-bar-container {
    padding: 20px;
    background: #030610;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--primary);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.progress-track {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
    transition: width 0.1s linear;
}

/* --- SCREEN 3: MAP --- */
#screen-map {
    background: #000;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
    filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(100%);
    /* This generic filter gives Leaflet's standard OSM map a cool dark/cyber theme instantly */
}

/* Fix for popup in inverted map */
.leaflet-popup {
    filter: invert(100%) hue-rotate(180deg) brightness(105%) contrast(105%);
}

.map-ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 500;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.map-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 30%, rgba(0, 0, 0, 0.8) 100%);
    pointer-events: none;
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(to bottom, transparent, rgba(0, 255, 204, 0.5), transparent);
    animation: scanLine 4s linear infinite;
    pointer-events: none;
}

@keyframes scanLine {
    0% {
        top: -10%;
    }

    100% {
        top: 110%;
    }
}

.target-card {
    background: rgba(10, 15, 29, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    border-radius: 24px 24px 0 0;
    padding: 24px;
    transform: translateY(100%);
    transition: transform 0.6s cubic-bezier(0.19, 1, 0.22, 1);
    pointer-events: all;
    z-index: 10;
}

.target-card.show {
    transform: translateY(0);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.status-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: bold;
}

.status-tag.success {
    background: rgba(0, 255, 204, 0.1);
    color: var(--primary);
    border: 1px solid rgba(0, 255, 204, 0.3);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--primary);
    animation: blink 1s infinite;
}

.close-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.info-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.grid-2 {
    flex-direction: row;
    gap: 20px;
}

.grid-2>div {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-row .label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.info-row .value {
    font-size: 15px;
    color: #fff;
    font-weight: 500;
}

.value.mono {
    font-family: var(--font-mono);
    color: var(--primary);
}

.value.tel-value {
    font-size: 18px;
    letter-spacing: 1px;
}

.txt-green {
    color: #00ffcc !important;
}

/* Custom Marker Leaflet Style */
.custom-radar-marker {
    background: none;
    border: none;
}

.custom-radar-marker .marker-dot {
    width: 16px;
    height: 16px;
    background: var(--alert);
    border-radius: 50%;
    box-shadow: 0 0 15px var(--alert);
    position: relative;
    top: -8px;
    left: -8px;
}

.custom-radar-marker .marker-pulse {
    position: absolute;
    top: -8px;
    left: -8px;
    width: 16px;
    height: 16px;
    background: transparent;
    border: 2px solid var(--alert);
    border-radius: 50%;
    animation: targetWave 1.5s infinite;
}

/* Utilities */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* Custom Webkit Scrollbar for terminal logic */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 2px;
}

/* --- LOGIN SCREEN SPECIFICS --- */
#screen-login {
    padding: 40px 24px;
    justify-content: center;
    background:
        radial-gradient(circle at 50% 0%, rgba(255, 0, 0, 0.05) 0%, transparent 40%),
        linear-gradient(to bottom, transparent, rgba(0, 136, 255, 0.05));
}
.error-text {
    color: var(--alert);
    font-size: 13px;
    text-align: center;
    min-height: 20px;
    font-weight: 600;
}
.logout-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 12px;
    padding: 10px;
    margin-top: 15px;
}
.logout-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    box-shadow: none;
    transform: none;
}
.hidden {
    display: none !important;
}

/* --- PROMO MODAL --- */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    opacity: 1;
    transition: opacity 0.3s;
}
.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    display: flex !important; /* Keep it flex but invisible */
}
.modal-content {
    background: var(--app-bg);
    border: 2px solid var(--primary);
    border-radius: 20px;
    padding: 30px 25px;
    width: 90%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.3);
    position: relative;
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.modal-overlay.hidden .modal-content {
    transform: scale(0.8);
}
.modal-icon {
    font-size: 40px;
    color: var(--primary);
    margin-bottom: 15px;
    text-shadow: 0 0 15px var(--alert-glow);
}
.modal-content h2 {
    color: #fff;
    font-size: 22px;
    margin-bottom: 10px;
}
.modal-content p {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 20px;
}
.promo-box {
    background: rgba(0, 255, 204, 0.05);
    border: 1px dashed rgba(0, 255, 204, 0.3);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 20px;
    position: relative;
}
.discount-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    padding: 4px 10px;
    border-radius: 10px;
    box-shadow: 0 0 10px var(--primary-glow);
}
.promo-box h3 {
    color: #fff;
    font-size: 16px;
    margin-top: 5px;
    margin-bottom: 8px;
}
.price-cut {
    color: var(--alert);
    text-decoration: line-through;
    font-size: 14px;
    margin-bottom: 2px;
}
.price {
    color: #00ffcc;
    font-size: 28px;
    font-weight: 900;
    text-shadow: 0 0 10px rgba(0, 255, 204, 0.4);
}
.btn-checkout {
    display: block;
    background: linear-gradient(135deg, #00ffcc 0%, #0088ff 100%);
    color: #000;
    text-decoration: none;
    border-radius: 12px;
    padding: 14px;
    font-weight: 900;
    font-size: 13px;
    text-transform: uppercase;
    box-shadow: 0 5px 15px rgba(0, 255, 204, 0.3);
    margin-bottom: 15px;
    transition: transform 0.2s;
}
.btn-checkout:hover {
    transform: translateY(-2px);
}
.btn-close-modal {
    background: transparent;
    color: var(--text-muted);
    border: none;
    font-size: 13px;
    text-decoration: underline;
    box-shadow: none;
    padding: 5px;
}
.btn-close-modal:hover {
    color: #fff;
    box-shadow: none;
    transform: none;
}

/* --- PWA INSTALL BANNER --- */
.install-banner {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 350px;
    background: rgba(10, 15, 29, 0.95);
    border: 1px solid var(--primary);
    box-shadow: 0 4px 20px rgba(255,0,0,0.4);
    border-radius: 12px;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 9999;
    backdrop-filter: blur(10px);
    transition: top 0.5s ease, opacity 0.5s ease;
}
.install-banner.hidden {
    top: -100px;
    opacity: 0;
    pointer-events: none;
    display: flex !important;
}
.install-info {
    color: #e0e6ed;
    font-size: 11px;
    line-height: 1.4;
    flex: 1;
    margin-right: 10px;
}
.install-info span {
    color: var(--primary);
    font-weight: bold;
    margin-right: 4px;
}
#btn-install {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255,0,0,0.3);
}
#btn-install-close {
    background: transparent;
    color: #738299;
    border: none;
    font-size: 18px;
    margin-left: 8px;
    cursor: pointer;
    padding: 0 4px;
}
#btn-install-close:hover {
    color: #fff;
}