/* Coverage Map Builder — styles.css — Pink/Rose Dark Theme */

:root {
    --bg: #0F172A;
    --bg2: #111827;
    --surface: #1A2440;
    --surface2: #1F2D4E;
    --border: #2D3D64;
    --pink: #EC4899;
    --pink2: #F472B6;
    --pink3: #FBCFE8;
    --blue: #3B82F6;
    --green: #10B981;
    --red: #EF4444;
    --err: #F87171;
    --text: #E2E8F0;
    --muted: #4A6090;
    --radius: 12px;
}

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

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui;
    font-size: 13px;
    -webkit-font-smoothing: antialiased;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ── Header ──────────────────────────────────────────── */
.app-header {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    gap: 10px;
}

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

.logo-icon {
    font-size: 1.2rem;
}

h1 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--pink2);
}

.hdr-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ── App body ────────────────────────────────────────── */
.app-body {
    flex: 1;
    display: flex;
    min-height: 0;
    overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
    width: 230px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    background: var(--bg2);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sb-section {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sb-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 700;
}

.sb-sublabel {
    font-size: 0.65rem;
    color: var(--muted);
    min-width: 55px;
}

.sb-input {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 7px;
    padding: 6px 9px;
    font-size: 0.75rem;
    outline: none;
}

.sb-input:focus {
    border-color: var(--pink);
}

.search-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.hint-text {
    font-size: 0.68rem;
}

.badge {
    background: rgba(236, 72, 153, 0.15);
    color: var(--pink);
    border-radius: 10px;
    padding: 0 6px;
    font-size: 0.65rem;
    margin-left: 4px;
}

/* Tool grid */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
}

.tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 4px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--muted);
    cursor: pointer;
    font-size: 0.62rem;
    transition: all 0.18s;
}

.tool-btn:hover {
    border-color: var(--pink);
    color: var(--text);
}

.tool-btn.active {
    border-color: var(--pink);
    background: rgba(236, 72, 153, 0.12);
    color: var(--pink2);
}

.tool-icon {
    font-size: 1.2rem;
}

/* Radius row */
.radius-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.radius-row.hidden {
    display: none;
}

/* Style row */
.style-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

input[type="color"] {
    width: 32px;
    height: 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    padding: 1px;
    background: none;
}

#opacity-val {
    font-size: 0.7rem;
    color: var(--muted);
    min-width: 30px;
}

/* Zones list */
.zones-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.empty-hint {
    font-size: 0.7rem;
    color: var(--muted);
    text-align: center;
    padding: 10px;
}

.zone-row {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: border-color 0.15s;
}

.zone-row:hover {
    border-color: var(--pink);
}

.zone-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.zone-row-name {
    flex: 1;
    font-size: 0.75rem;
    font-weight: 500;
}

.zone-row-area {
    font-size: 0.65rem;
    color: var(--muted);
}

.zone-row-del {
    font-size: 0.8rem;
    color: var(--muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 4px;
    transition: color 0.15s;
}

.zone-row-del:hover {
    color: var(--err);
}

/* Stats section */
.stats-section {}

.stats-grid {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
}

.stat-lbl {
    color: var(--muted);
}

.stat-val {
    color: var(--pink2);
    font-weight: 600;
}

/* ── Map ─────────────────────────────────────────────── */
.map-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%;
}

.map-hint {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(236, 72, 153, 0.3);
    color: var(--pink3);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 0.78rem;
    z-index: 800;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 0.3s;
}

.drawing-progress {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--pink);
    border-radius: 10px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.78rem;
    z-index: 800;
    color: var(--pink3);
}

.drawing-progress.hidden {
    display: none;
}

/* Leaflet overrides */
.leaflet-container {
    background: #0F172A;
}

.leaflet-tile-pane {
    filter: brightness(0.85) saturate(0.9) hue-rotate(200deg);
}

.leaflet-bar a {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

.leaflet-bar a:hover {
    background: var(--pink) !important;
    color: #fff !important;
}

/* ── Modal ───────────────────────────────────────────── */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-body {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    width: 100%;
    max-width: 540px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.modal-hdr h2 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--pink2);
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.18s;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--pink);
    color: #fff;
    font-weight: 700;
}

.btn-primary:hover {
    background: #DB2777;
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    color: var(--text);
    border-color: var(--pink);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--err);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: var(--red);
    color: #fff;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.7rem;
}

/* ── Toast ───────────────────────────────────────────── */
#toast-wrap {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.toast {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.8rem;
    animation: slide-up .2s ease;
}

.toast.ok {
    border-color: rgba(16, 185, 129, .4);
    color: #6EE7B7;
}

.toast.err {
    border-color: rgba(248, 113, 113, .4);
    color: var(--err);
}

.toast.warn {
    border-color: rgba(245, 158, 11, .4);
    color: #FCD34D;
}

@keyframes slide-up {
    from {
        transform: translateY(8px);
        opacity: 0;
    }
}

.hidden {
    display: none !important;
}

@media (max-width: 620px) {

    html,
    body {
        overflow: auto;
    }

    .app,
    .app-body {
        height: auto;
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .map-container {
        height: 400px;
    }
}