/* GPS Tracks Live website, styled after dmsoftwaresolutions.com (Silicon theme, dark) */
:root {
    --bg: #0b0f19;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-solid: #131826;
    --text: rgba(255, 255, 255, 0.7);
    --heading: #ffffff;
    --muted: #9397ad;
    --border: rgba(255, 255, 255, 0.14);
    --hover: rgba(255, 255, 255, 0.05);
    --selected: rgba(99, 102, 241, 0.16);
    --primary: #6366f1;
    --primary-hover: #5457d6;
    --primary-text: #ffffff;
    --danger: #ef4444;
    --success: #22c55e;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --header-height: 72px;
    color-scheme: dark;
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    color: var(--text);
    /* the site's hero: navy with a faint indigo glow */
    background: radial-gradient(1200px 600px at 85% -10%, rgba(99, 102, 241, 0.16), transparent 60%), var(--bg) fixed;
    background-color: var(--bg);
    min-height: 100vh;
}

a { color: var(--primary); }
h1, h2, h3 { color: var(--heading); font-weight: 800; letter-spacing: -0.01em; }
h1 { font-size: 2rem; margin: 0; }
h2 { font-size: 1.2rem; margin: 0 0 12px; font-weight: 700; }
h3 { font-size: 1rem; margin: 20px 0 8px; font-weight: 700; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

/* MARK: header */

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    height: var(--header-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.35rem;
    color: var(--heading);
    text-decoration: none;
    white-space: nowrap;
}
.brand img { border-radius: 10px; }
.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}
.site-nav a {
    padding: 8px 14px;
    border-radius: var(--radius);
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
    text-decoration: none;
}
.site-nav a:hover { color: var(--primary); }
.site-nav a.active { color: var(--primary); }
.nav-signout {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--muted);
    font: inherit;
    cursor: pointer;
    padding: 8px 12px;
}
.nav-signout:hover { color: var(--heading); }
.menu-toggle { display: none; }

/* MARK: page layout */

main { min-height: calc(100vh - var(--header-height)); }
.page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}
.page.narrow { max-width: 760px; }
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

/* desktop: list on the left, detail or map on the right */
.split {
    display: grid;
    grid-template-columns: minmax(320px, 420px) 1fr;
    gap: 20px;
    align-items: start;
}
.split > .detail-pane {
    position: sticky;
    top: calc(var(--header-height) + 16px);
}
.list-pane .list {
    max-height: calc(100vh - var(--header-height) - 220px);
    overflow-y: auto;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}
.card + .card { margin-top: 16px; }

/* MARK: tabs and filters */

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.tabs a {
    padding: 8px 14px;
    color: var(--muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.tabs a { font-weight: 600; }
.tabs a:hover { color: var(--heading); }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.filters input[type="search"] { flex: 1 1 180px; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], select {
    font: inherit;
    color: var(--heading);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius);
    padding: 10px 14px;
    min-width: 0;
}
input::placeholder { color: var(--muted); }
select option { background: var(--surface-solid); color: var(--heading); }
input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0.5rem 1.125rem -0.5rem rgba(99, 102, 241, 0.6);
}
button:focus-visible, a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* MARK: lists */

.list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
}
.list-item:last-child { border-bottom: none; }
a.list-item:hover { background: var(--hover); }
.list-item.selected { background: var(--selected); }
.list-item .item-main { flex: 1; min-width: 0; }
.list-item .item-title { color: var(--heading); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .item-meta { font-size: 0.875rem; color: var(--muted); }
.list-group-title {
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.list-count { font-size: 0.875rem; color: var(--muted); margin: 8px 2px 0; }
/* friend requests put Accept and Decline on their own line under the name */
.list-item.request { flex-wrap: wrap; }
.list-item.request .actions { width: 100%; padding-left: 52px; }

.swatch {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}
.avatar.large { width: 72px; height: 72px; font-size: 1.6rem; }

.badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--muted);
    white-space: nowrap;
}
.badge.live { background: rgba(34, 197, 94, 0.15); border-color: rgba(34, 197, 94, 0.5); color: var(--success); }

/* MARK: buttons */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: transparent;
    color: var(--heading);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.button:hover { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.3); }
.button.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); box-shadow: 0 0.5rem 1.125rem -0.5rem rgba(99, 102, 241, 0.9); }
.button.danger { color: var(--danger); border-color: rgba(239, 68, 68, 0.5); }
.button.danger:hover { background: rgba(239, 68, 68, 0.1); }
.button.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.button:disabled { opacity: 0.55; cursor: default; }
.button.block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.link-button {
    background: none;
    border: none;
    padding: 0;
    color: var(--primary);
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
}

/* MARK: forms */

.form-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.form-field label { color: var(--heading); font-weight: 600; font-size: 0.9rem; }
.form-field .hint { font-size: 0.8rem; color: var(--muted); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { flex: 1 1 220px; }

.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}
.auth-card { width: 100%; max-width: 420px; padding: 32px; }
.auth-card h1 { margin-bottom: 4px; font-size: 1.75rem; }
.auth-brand { display: flex; align-items: center; gap: 12px; color: var(--heading); font-weight: 800; font-size: 1.35rem; margin-bottom: 24px; }
.auth-brand img { border-radius: 12px; }
.auth-links { display: flex; justify-content: space-between; margin-top: 16px; font-size: 0.9rem; }

/* MARK: detail */

.detail-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}
.back-link { display: inline-block; margin-bottom: 12px; text-decoration: none; }
.map {
    height: 440px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--hover);
    position: relative;
}
.map.tall { height: calc(100vh - var(--header-height) - 140px); min-height: 420px; }
.map .map-message {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    padding: 24px;
    text-align: center;
}
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin: 16px 0;
}
.stat {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
}
.stat-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.stat-value { color: var(--heading); font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.notes { white-space: pre-wrap; }

.chart svg { width: 100%; height: 180px; display: block; }
.chart text { fill: var(--muted); font-size: 10px; }
.chart .grid { stroke: var(--border); stroke-width: 0.5; }
.chart .line { fill: none; stroke-width: 2; }
.chart .area { opacity: 0.18; }
.chart .cursor { stroke: var(--muted); stroke-width: 1; }
.chart-readout { font-size: 0.85rem; color: var(--muted); text-align: center; min-height: 1.3em; }

.pictures { display: flex; gap: 8px; flex-wrap: wrap; }
.pictures button { padding: 0; border: none; background: none; cursor: zoom-in; }
.pictures img { height: 110px; border-radius: 6px; display: block; }

.placeholder {
    padding: 48px 24px;
    text-align: center;
    color: var(--muted);
}
.notice {
    border: 1px solid rgba(99, 102, 241, 0.4);
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 16px;
}
.notice strong { color: var(--heading); }
.danger-zone { border-color: rgba(239, 68, 68, 0.45); }

.spinner {
    margin: 40px auto;
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--muted);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* MARK: dialogs and toast */

dialog {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-solid);
    color: var(--text);
    padding: 24px;
    max-width: min(480px, calc(100vw - 32px));
}
dialog.image-dialog { max-width: min(1000px, calc(100vw - 32px)); padding: 12px; }
dialog.image-dialog img { max-width: 100%; max-height: 80vh; display: block; margin: 0 auto 12px; }
dialog::backdrop { background: rgba(5, 7, 13, 0.7); }
dialog .actions { justify-content: flex-end; margin-top: 20px; }

#toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    max-width: calc(100vw - 32px);
    padding: 10px 16px;
    border-radius: 6px;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    color: var(--heading);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    z-index: 30;
}
#toast.visible { opacity: 1; }

/* MARK: phone */

@media (max-width: 899px) {
    :root { --header-height: 60px; }
    .header-inner { padding: 0 16px; gap: 12px; justify-content: space-between; }
    .menu-toggle {
        display: inline-flex;
        font: inherit;
        font-weight: 600;
        padding: 8px 14px;
        border: 1px solid rgba(255, 255, 255, 0.18);
        border-radius: var(--radius);
        background: transparent;
        color: var(--heading);
    }
    .site-nav {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: var(--surface-solid);
        border-bottom: 1px solid var(--border);
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
    }
    .site-nav.open { display: flex; }
    .site-nav a, .nav-signout {
        padding: 14px 20px;
        border-radius: 0;
        border-top: 1px solid var(--border);
        text-align: left;
        margin: 0;
    }
    .page { padding: 16px 12px 40px; }
    h1 { font-size: 1.6rem; }
    .brand { font-size: 1.15rem; }
    .brand img { width: 34px; height: 34px; }
    .card { padding: 16px; }
    .list-item { padding: 14px 12px; min-height: 56px; }
    .map { height: 280px; }
    .map.tall { height: 60vh; min-height: 300px; }
    .detail-header .actions { width: 100%; }
    .detail-header .actions > * { flex: 1; }
    .detail-header .actions select { flex-basis: 100%; }
    .filters select { flex: 1 1 140px; }
    .tabs a { flex: 1; text-align: center; }
    .details { grid-template-columns: 1fr; gap: 2px; }
    .details dd { margin-bottom: 8px; }
    #toast { bottom: 16px; }
}

/* MARK: map arrow (the app's orange user arrow) */

.map-arrow { position: relative; width: 24px; height: 24px; }
.map-arrow-image { display: block; transition: transform 0.15s linear; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6)); }
.map-arrow-label {
    position: absolute;
    top: 26px;
    left: 50%;
    transform: translateX(-50%);
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(11, 15, 25, 0.85);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.chart-legend { display: flex; gap: 16px; font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.chart-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend-swatch { width: 12px; height: 3px; border-radius: 2px; }
.chart .line.secondary { stroke-width: 1.75; }

/* map type dropdown, top-left over the map */
.map-type-select {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 5;
    padding: 6px 10px;
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(11, 15, 25, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius);
    color: var(--heading);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* dropdown menu (Download) */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: "▾"; margin-left: 6px; font-size: 0.8em; }
.menu-items {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 20;
    min-width: 140px;
    padding: 6px;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}
.menu-items button {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--heading);
    font: inherit;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}
.menu-items button:hover { background: var(--hover); }

.list-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.list-footer .list-count { margin: 0; }
.list-footer .button { padding: 6px 14px; }
