/* area-style.css - Mobile-Optimized Geofence Styles */

:root {
    --bg-primary: #080a10;
    --bg-secondary: #0f131e;
    --card-bg: rgba(17, 22, 37, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    
    --primary: #6366f1;
    --primary-gradient: linear-gradient(135deg, #6366f1, #a855f7);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #5e6b7e;
    
    /* Default is outside (Red Accent) */
    --accent: #ef4444;
    --accent-gradient: linear-gradient(135deg, #ef4444, #b91c1c);
    --accent-glow: rgba(239, 68, 68, 0.2);
    
    --font-sans: 'Outfit', -apple-system, sans-serif;
    --font-mono: 'Space Grotesk', monospace;
    
    --transition-speed: 0.4s;
}

/* Green overrides when inside the boundary */
body.inside-boundary {
    --accent: #10b981;
    --accent-gradient: linear-gradient(135deg, #10b981, #059669);
    --accent-glow: rgba(16, 185, 129, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(at 50% 0%, var(--accent-glow) 0px, transparent 60%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    padding-bottom: env(safe-area-inset-bottom);
    transition: background-image var(--transition-speed) ease;
}

/* Header & Status Combined (Sticky on Mobile) */
.header-bar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(8, 10, 16, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--card-border);
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-title {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-title span {
    color: var(--accent);
    transition: color var(--transition-speed) ease;
}

.nav-link {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.nav-link:active {
    background: rgba(255, 255, 255, 0.1);
}

/* Large Status Banner */
.status-banner {
    background: var(--accent-gradient);
    border-radius: 12px;
    padding: 0.6rem;
    text-align: center;
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 0 4px 15px var(--accent-glow);
    transition: all var(--transition-speed) ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.status-banner-pulse {
    width: 10px;
    height: 10px;
    background-color: white;
    border-radius: 50%;
    animation: markerPulse 1.5s infinite;
}

/* Map takes full layout on mobile */
.map-viewport-wrapper {
    flex-grow: 1;
    position: relative;
    width: 100%;
    height: 45vh; /* Adjusted for mobile portrait */
    min-height: 280px;
    border-bottom: 1px solid var(--card-border);
}

#map-viewport {
    width: 100%;
    height: 100%;
    background: #0d0f17;
}

.map-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(8, 10, 16, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.5rem;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

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

.map-overlay p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    max-width: 250px;
}

/* Bottom Control & Telemetry Deck */
.control-deck {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.25rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* Collapsible Settings Drawer */
.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.accordion-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.accordion-icon {
    transition: transform 0.3s ease;
}

.accordion-header.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    display: none;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 0.75rem;
}

.accordion-content.show {
    display: block;
}

/* Coordinates Setting Form Grid */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

@media (min-width: 480px) {
    .settings-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.point-field-group {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 0.6rem;
    border-radius: 10px;
}

.point-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    display: block;
}

.input-row {
    display: flex;
    gap: 0.4rem;
}

.input-row div {
    flex: 1;
}

.input-row label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.15rem;
}

.input-row input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: white;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-align: center;
}

.input-row input:focus {
    border-color: var(--primary);
    outline: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.85rem;
    border: none;
    border-radius: 12px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: var(--primary-gradient);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.btn-secondary:active {
    background: rgba(255, 255, 255, 0.08);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Telemetry Display Widgets */
.telemetry-deck {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.telemetry-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 0.75rem;
    border-radius: 12px;
    text-align: center;
}

.telemetry-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.15rem;
    display: block;
}

.telemetry-value {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.telemetry-value.coord {
    font-size: 0.85rem;
}

.telemetry-value.accented {
    color: var(--accent);
    transition: color var(--transition-speed) ease;
}

.error-alert {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 0.85rem;
    border-radius: 12px;
    font-size: 0.8rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    animation: shake 0.5s ease-in-out;
}

/* Leaflet Overrides */
.leaflet-bar {
    border: none !important;
}

.glowing-marker {
    background: var(--accent);
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 15px var(--accent);
    animation: markerPulse 2s infinite;
    transition: background var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.nav-arrow-marker {
    background: transparent !important;
    border: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.arrow-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, filter var(--transition-speed) ease, color var(--transition-speed) ease;
}

/* Animations */
@keyframes markerPulse {
    0% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 var(--accent);
    }
    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(0,0,0,0);
    }
    100% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(0,0,0,0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

/* Onboarding Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 15, 30, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    display: none !important;
}

/* Modal Card */
.modal-card {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    padding: 2rem;
    color: #ffffff;
    box-sizing: border-box;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    text-align: center;
    color: #ffffff;
}

.modal-subtitle {
    font-size: 0.9rem;
    color: #94a3b8;
    text-align: center;
    margin-bottom: 1.5rem;
}

.modal-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.2rem;
}

.modal-form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #e2e8f0;
}

.modal-form-group input[type="text"],
.modal-form-group select {
    background: #0f172a;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.modal-form-group input[type="text"]:focus,
.modal-form-group select:focus {
    border-color: var(--primary);
}

/* Modal Coordinates Section */
.modal-coordinates-header {
    font-size: 0.95rem;
    font-weight: 700;
    color: #94a3b8;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.4rem;
}

.modal-coordinates-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.modal-point-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-point-row .point-num {
    font-size: 0.85rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    min-width: 24px;
    text-align: center;
}

.modal-point-row input[type="number"] {
    background: #0f172a;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    flex: 1;
    width: 0;
    transition: border-color 0.2s;
}

.modal-point-row input[type="number"]:focus {
    border-color: var(--primary);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Admin Portal Layout Styles */
.admin-portal-body {
    background: radial-gradient(circle at 50% 50%, #0f172a 0%, #020617 100%);
    min-height: 100vh;
    font-family: 'Outfit', sans-serif;
    color: #f1f5f9;
    margin: 0;
    padding: 0;
}

.admin-login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
    box-sizing: border-box;
}

.login-card {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.login-card h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    text-align: center;
    background: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-subtitle {
    font-size: 0.9rem;
    color: #94a3b8;
    text-align: center;
    margin-bottom: 2rem;
}

.error-alert {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    font-size: 0.85rem;
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    text-align: center;
}

.error-alert.hidden {
    display: none !important;
}

.dashboard-container {
    animation: fadeIn 0.4s ease-out;
}

/* Admin Table Customization */
.admin-logs-table th {
    font-family: 'Space Grotesk', sans-serif;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-logs-table td {
    vertical-align: middle;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Event Tags */
.admin-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.tag-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.tag-error {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.tag-info {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.tag-info-light {
    background: rgba(14, 165, 233, 0.1);
    color: #7dd3fc;
    border: 1px solid rgba(14, 165, 233, 0.2);
}

.tag-warning {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.tag-warning-light {
    background: rgba(245, 158, 11, 0.1);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.tag-default {
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Table empty state message */
#table-empty-state.hidden {
    display: none !important;
}

/* Metrics glowing borders */
.metrics-card {
    transition: transform 0.2s, box-shadow 0.2s;
}
.metrics-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.15);
}
