/* Modern Design System - Silent Signal */
:root {
    --primary: #4F46E5; /* Indigo */
    --primary-dark: #4338ca;
    --secondary: #0EA5E9; /* Sky Blue */
    --accent: #F43F5E; /* Rose for Alerts */
    --success: #10B981; /* Emerald */
    --warning: #F59E0B; /* Amber */
    --bg-app: #F8FAFC;
    --surface: #FFFFFF;
    --text-main: #1E293B;
    --text-muted: #64748B;
    --border: #E2E8F0;
    --nav-height: 70px;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.3);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f1f5f9; /* Desktop background */
    color: var(--text-main);
    margin: 0;
    line-height: 1.5;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

/* Mobile App Simulation Container */
.app-frame {
    width: 100%;
    max-width: 414px; /* iPhone Max width */
    background-color: var(--bg-app);
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 50px rgba(0,0,0,0.1);
    padding-bottom: var(--nav-height);
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4 {
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.02em;
}

h1 { font-size: 28px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

p { margin: 0 0 1rem 0; color: var(--text-muted); font-size: 14px; }
.small-text { font-size: 12px; color: var(--text-muted); }

/* Header */
.app-header {
    padding: 20px 24px;
    background: var(--surface);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

/* Components */
.card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 20px;
    margin: 16px 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:active {
    transform: scale(0.98);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    border: none;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
    text-decoration: none;
    font-size: 16px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.3);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-main);
}

/* Status Indicators */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #DCFCE7;
    color: #166534;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-pill.active {
    background: #DCFCE7;
    color: #166534;
}

.status-pill.warning {
    background: #FEF3C7;
    color: #92400E;
}

.status-pill.offline {
    background: #F1F5F9;
    color: #475569;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(0.95); opacity: 1; }
}

/* Map Placeholder */
.map-container {
    height: 250px;
    background-color: #e2e8f0;
    background-image: 
        linear-gradient(rgba(0,0,0,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    border-radius: var(--radius-lg);
    margin: 16px 24px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
}

.map-pin {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 50% 50% 0 50%;
    transform: rotate(45deg);
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -20px;
    margin-left: -20px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-pin::after {
    content: '';
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    transform: rotate(-45deg);
}

.geofence-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 180px;
    height: 180px;
    border: 2px dashed var(--primary);
    border-radius: 50%;
    background: rgba(79, 70, 229, 0.05);
    pointer-events: none;
    animation: breathe 4s ease-in-out infinite;
}

@keyframes breathe {
    0% { transform: translate(-50%, -50%) scale(1); border-color: rgba(79, 70, 229, 0.4); }
    50% { transform: translate(-50%, -50%) scale(1.05); border-color: rgba(79, 70, 229, 0.8); }
    100% { transform: translate(-50%, -50%) scale(1); border-color: rgba(79, 70, 229, 0.4); }
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 414px;
    background: var(--surface);
    height: var(--nav-height);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid var(--border);
    z-index: 200;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 10px;
    gap: 4px;
}

.nav-item.active {
    color: var(--primary);
}

.nav-icon {
    width: 24px;
    height: 24px;
    background: #E2E8F0;
    border-radius: 6px;
}

.nav-item.active .nav-icon {
    background: var(--primary);
}

/* Custom Features */
.feature-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}
.feature-row:last-child {
    border-bottom: none;
}

.toggle-switch {
    width: 44px;
    height: 24px;
    background: #CBD5E1;
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-switch.checked {
    background: var(--primary);
}

.toggle-knob {
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.toggle-switch.checked .toggle-knob {
    transform: translateX(20px);
}

/* Alert Overlay */
.alert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--surface);
    z-index: 300;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px;
}

.countdown-circle {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 8px solid #FEE2E2;
    border-top: 8px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    font-weight: 800;
    color: var(--accent);
    margin: 40px 0;
    animation: spin 3s linear reverse; /* Fake countdown visual */
}

/* Placeholder Helpers */
.placeholder-icon {
    width: 24px;
    height: 24px;
    background-color: currentColor;
    mask-size: contain;
    mask-position: center;
    mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    -webkit-mask-position: center;
    -webkit-mask-repeat: no-repeat;
}

/* Icons */
.icon-home { -webkit-mask-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2V9z" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>'); }
.icon-settings { -webkit-mask-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="3" stroke="black" stroke-width="2"/><path d="M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 010 2.83 2 2 0 01-2.83 0l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-2 2 2 2 0 01-2-2v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83 0 2 2 0 010-2.83l.06-.06a1.65 1.65 0 00.33-1.82 1.65 1.65 0 00-1.51-1H3a2 2 0 01-2-2 2 2 0 012-2h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 010-2.83 2 2 0 012.83 0l.06.06a1.65 1.65 0 001.82.33H9a1.65 1.65 0 001-1.51V3a2 2 0 012-2 2 2 0 012 2v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 0 2 2 0 010 2.83l-.06.06a1.65 1.65 0 00-.33 1.82V9a1.65 1.65 0 001.51 1H21a2 2 0 012 2 2 2 0 01-2 2h-.09a1.65 1.65 0 00-1.51 1z" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>'); }
.icon-shield { -webkit-mask-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>'); }
.icon-bluetooth { -webkit-mask-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6.5 6.5l11 11L12 23V1l5.5 5.5-11 11" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>'); }

/* Alert Animation */
@keyframes mesh-pulse {
    0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.7); }
    70% { box-shadow: 0 0 0 20px rgba(79, 70, 229, 0); }
    100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}

.mesh-node {
    width: 60px;
    height: 60px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin: 0 auto;
    animation: mesh-pulse 2s infinite;
}
