/* ==========================================================================
   PinUs — design tokens
   A "night map" aesthetic: the product's job is showing where people are
   on a map, so the chrome gets out of the way and reads like map UI itself
   — dark canvas, floating glass panels, pins as the recurring motif.
   ========================================================================== */

:root {
    --bg: #0F1720;
    --surface: #16212Cf2;
    --surface-solid: #16212C;
    --surface-2: #1D2B38;
    --border: #29394A;
    --text: #F5F3EE;
    --text-muted: #8FA0AF;
    --accent: #FF6B4A;
    --accent-ink: #2A0F08;
    --accent-2: #2DD4BF;
    --warn: #F5C451;
    --danger: #FF6B6B;

    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;

    --radius-s: 8px;
    --radius-m: 14px;
    --radius-l: 22px;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible {
    outline: 2px solid var(--accent-2);
    outline-offset: 2px;
}

button {
    font-family: inherit;
    cursor: pointer;
}

input, select {
    font-family: inherit;
    font-size: 15px;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    padding: 11px 13px;
    width: 100%;
}

input::placeholder { color: var(--text-muted); }

input:focus, select:focus {
    outline: none;
    border-color: var(--accent-2);
}

label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

.field { margin-bottom: 16px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: var(--radius-s);
    padding: 11px 18px;
    font-size: 15px;
    font-weight: 600;
    transition: transform 0.12s ease, filter 0.12s ease;
}
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }

.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); }

.btn-block { width: 100%; }

.btn-sm { padding: 7px 12px; font-size: 13px; }

.error-banner {
    background: rgba(255, 107, 107, 0.12);
    border: 1px solid rgba(255, 107, 107, 0.4);
    color: #FFB3B3;
    border-radius: var(--radius-s);
    padding: 10px 13px;
    font-size: 13.5px;
    margin-bottom: 16px;
}

/* ---------- Auth pages (login / register) ---------- */

.auth-shell {
    min-height: 100%;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
}

@media (max-width: 860px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
}

.auth-brand {
    position: relative;
    background:
        radial-gradient(circle at 30% 30%, rgba(255, 107, 74, 0.16), transparent 55%),
        radial-gradient(circle at 70% 70%, rgba(45, 212, 191, 0.10), transparent 55%),
        var(--bg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px;
    overflow: hidden;
    border-right: 1px solid var(--border);
}

.auth-wordmark {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.auth-wordmark .dot { color: var(--accent); }

.auth-ripple {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 1px;
    height: 1px;
}

.auth-ripple .ring {
    position: absolute;
    left: 50%;
    top: 50%;
    border: 1px solid var(--accent);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    animation: ripple 3.6s ease-out infinite;
}
.auth-ripple .ring:nth-child(2) { animation-delay: 0.9s; }
.auth-ripple .ring:nth-child(3) { animation-delay: 1.8s; }
.auth-ripple .ring:nth-child(4) { animation-delay: 2.7s; }

.auth-ripple .pin {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50% 50% 50% 0;
    transform: translate(-50%, -70%) rotate(-45deg);
    box-shadow: 0 0 0 5px rgba(255, 107, 74, 0.18);
}

@keyframes ripple {
    0%   { width: 20px; height: 20px; opacity: 0.55; }
    100% { width: 480px; height: 480px; opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-ripple .ring { animation: none; opacity: 0.15; width: 220px; height: 220px; }
}

.auth-tagline {
    font-family: var(--font-display);
    font-size: 34px;
    line-height: 1.25;
    max-width: 420px;
    position: relative;
    z-index: 1;
}
.auth-tagline em { color: var(--accent); font-style: normal; }

.auth-sub {
    color: var(--text-muted);
    font-size: 14px;
    position: relative;
    z-index: 1;
}

.auth-form-side {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.auth-card {
    width: 100%;
    max-width: 380px;
}

.auth-card h1 {
    font-family: var(--font-display);
    font-size: 28px;
    margin: 0 0 6px;
}

.auth-card p.lead {
    color: var(--text-muted);
    font-size: 14.5px;
    margin: 0 0 28px;
}

.auth-switch {
    margin-top: 22px;
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
}
.auth-switch a { color: var(--accent-2); font-weight: 600; text-decoration: none; }

/* ---------- Dashboard shell ---------- */

.app-shell {
    height: 100vh;
    width: 100vw;
    position: relative;
    overflow: hidden;
}

#map {
    position: absolute;
    inset: 0;
    background: #0c141c;
}

.topbar {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    pointer-events: none;
}

.topbar > * { pointer-events: auto; }

.brand-pill {
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 16px;
    box-shadow: var(--shadow);
}
.brand-pill .dot { color: var(--accent); }

.circle-switcher {
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 6px 6px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow);
}
.circle-switcher select {
    background: transparent;
    border: none;
    padding: 4px 6px;
    width: auto;
    max-width: 160px;
}

.account-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 14px 6px 6px;
    box-shadow: var(--shadow);
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12.5px;
    color: #0c141c;
    flex-shrink: 0;
}

.sidebar {
    position: absolute;
    top: 76px;
    left: 16px;
    bottom: 16px;
    width: 320px;
    z-index: 400;
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (max-width: 720px) {
    .sidebar {
        left: 8px;
        right: 8px;
        width: auto;
        top: auto;
        bottom: 8px;
        height: 46vh;
    }
    .topbar { left: 8px; right: 8px; }
    .brand-pill span.tag { display: none; }
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    padding: 13px 6px;
    border-bottom: 2px solid transparent;
}
.tab-btn.active {
    color: var(--text);
    border-bottom-color: var(--accent);
}

.tab-panel {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: none;
}
.tab-panel.active { display: block; }

.member-row, .place-row, .alert-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: var(--radius-s);
    margin-bottom: 4px;
    cursor: pointer;
}
.member-row:hover, .place-row:hover { background: var(--surface-2); }
.member-row.selected { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--accent-2); }

.member-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #0c141c;
    position: relative;
    flex-shrink: 0;
}
.member-avatar .pulse {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--accent-2);
    border: 2px solid var(--surface-solid);
}

.member-info { flex: 1; min-width: 0; }
.member-name { font-weight: 600; font-size: 14px; }
.member-meta {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.section-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin: 4px 2px 10px;
}

.invite-box {
    background: var(--surface-2);
    border: 1px dashed var(--border);
    border-radius: var(--radius-s);
    padding: 12px;
    text-align: center;
    margin-bottom: 16px;
}
.invite-code {
    font-family: var(--font-mono);
    font-size: 20px;
    letter-spacing: 0.12em;
    color: var(--accent-2);
    margin: 4px 0 8px;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    font-size: 13.5px;
    padding: 24px 10px;
    line-height: 1.5;
}

.place-row .place-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.alert-row .alert-type {
    font-size: 12px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
}
.alert-type.arrived { background: rgba(45, 212, 191, 0.15); color: var(--accent-2); }
.alert-type.left { background: rgba(245, 196, 81, 0.15); color: var(--warn); }

.floating-actions {
    position: absolute;
    bottom: 20px;
    right: 16px;
    z-index: 400;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.fab {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    color: var(--text);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.fab:hover { background: var(--surface-2); }

.toast {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 13.5px;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(6, 10, 14, 0.6);
    backdrop-filter: blur(2px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-backdrop.hidden { display: none; }

.modal {
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-l);
    padding: 24px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow);
}
.modal h2 {
    font-family: var(--font-display);
    font-size: 20px;
    margin: 0 0 4px;
}
.modal p.hint {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0 0 18px;
}
.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}
.modal-actions .btn { flex: 1; }

/* Leaflet pin marker */
.pinus-marker {
    width: 34px;
    height: 34px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0,0,0,0.4);
    border: 2px solid #0c141c;
}
.pinus-marker span {
    transform: rotate(45deg);
    font-weight: 700;
    font-size: 12px;
    color: #0c141c;
}
.pinus-place-marker {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-2);
    border: 2px solid #0c141c;
    box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.2);
}
