/*
    Created on : 20 Sept 2025, 22:38:04
    Author     : Andrei
*/

:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --text: #1d2330;
    --muted: #5d6677;
    --border: #dde1e7;
    --topbar: #1d2330;
    --accent: #e8590c;
    --primary: #1f5fbf;
    --primary-hover: #194f9f;
    --danger: #c92a2a;
    --ok-bg: #e6f4ea;
    --ok-text: #1e6b34;
    --due-bg: #fff3d6;
    --due-text: #8a5a00;
    --overdue-bg: #fde4e4;
    --overdue-text: #a61e1e;
    --radius: 8px;
}

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

a { color: var(--primary); }

.h1, .h2, .h3, h1, h2, h3 {
    margin: 0 0 .5rem;
    font-weight: 600;
    line-height: 1.25;
}
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }

/* top bar and menu */
.topbar { background: var(--topbar); color: #fff; }
.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    min-height: 56px;
    gap: 8px;
}
.brand { color: #fff; font-weight: 700; font-size: 1.15rem; text-decoration: none; margin-right: 24px; }
.brand span { color: var(--accent); }
.nav { display: flex; flex: 1; align-items: center; gap: 4px; }
.nav a { color: #c9d0dc; text-decoration: none; padding: 8px 12px; border-radius: 6px; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav a.active { color: #fff; background: rgba(255,255,255,.14); }
.nav-user { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav-name { color: #fff; padding: 0 8px; }
.nav-toggle { display: none; }
.nav-toggle-label { display: none; }

@media (max-width: 860px) {
    .nav-toggle-label {
        display: block;
        margin-left: auto;
        padding: 6px 12px;
        border: 1px solid rgba(255,255,255,.3);
        border-radius: 6px;
        cursor: pointer;
    }
    .nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding-bottom: 12px; }
    .nav-toggle:checked ~ .nav { display: flex; }
    .nav-user { margin-left: 0; flex-direction: column; align-items: stretch; border-top: 1px solid rgba(255,255,255,.15); padding-top: 8px; }
    .nav-name { padding: 8px 12px; }
}

/* page */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 16px; }
.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 16px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin: 2px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions form { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .02em; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}
.card > h2:first-child { margin-bottom: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-2 > .card { margin-bottom: 0; }
.grid { margin-bottom: 20px; }
.stack > * + * { margin-top: 20px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; }
.stat-value { font-size: 1.6rem; font-weight: 700; white-space: nowrap; }
.stat-label { color: var(--muted); }

/* details: label / value list */
.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }

/* tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.table tbody tr:hover { background: #fafbfc; }
.table tfoot td { font-weight: 600; border-bottom: 0; }
.empty { color: var(--muted); padding: 12px 0; margin: 0; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok-text); }
.badge-due { background: var(--due-bg); color: var(--due-text); }
.badge-overdue { background: var(--overdue-bg); color: var(--overdue-text); }
.badge-muted { background: #eceef2; color: var(--muted); }

/* buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    text-decoration: none;
    cursor: pointer;
    line-height: 1.4;
}
.btn:hover { background: #f0f2f5; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: #f0b4b4; }
.btn-danger:hover { background: var(--overdue-bg); }
.btn-small { padding: 4px 10px; font-size: .85rem; }
.btn-block { width: 100%; }
.link-button { background: none; border: 0; padding: 0; color: var(--danger); font: inherit; cursor: pointer; text-decoration: underline; }

/* forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 20px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-wide { grid-column: 1 / -1; }
label { font-weight: 600; font-size: .9rem; }
.hint { color: var(--muted); font-size: .85rem; margin: 0; font-weight: normal; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=search], input[type=tel], select, textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #c4cad4;
    border-radius: 6px;
    font: inherit;
    background: #fff;
    color: var(--text);
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .85rem; margin: 0; }
.checkbox { display: flex; gap: 8px; align-items: flex-start; font-weight: normal; }
.checkbox input { margin-top: 4px; }
.form-actions { display: flex; gap: 8px; margin-top: 20px; }
.search { display: flex; gap: 8px; margin-bottom: 16px; max-width: 520px; }
.search input { flex: 1; }

.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-success { background: var(--ok-bg); color: var(--ok-text); border-color: #bfe3c8; }
.alert-error { background: var(--overdue-bg); color: var(--overdue-text); border-color: #f4c2c2; }
.alert ul { margin: 4px 0 0; padding-left: 20px; }

/* login */
.auth-box { max-width: 400px; margin: 48px auto; }
.auth-box .field { margin-bottom: 16px; }

.mt { margin-top: 20px; }
.mb { margin-bottom: 12px; }
.field-end { justify-content: flex-end; }
.actions-end { justify-content: flex-end; }

/* map */
.card-map { padding: 0; overflow: hidden; }
.card-map .empty { padding: 12px 20px; }
.map { height: 60vh; min-height: 360px; background: #e9ecef; }
.map-tall { height: 70vh; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.compare-table th[scope=row] { color: var(--muted); font-weight: 600; white-space: nowrap; }

/* day / range picker */
.period-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 16px; }
.period-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.period-form input[type=date] { width: auto; }
.quick { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.quick a { padding: 4px 10px; border-radius: 99px; text-decoration: none; font-size: .9rem; }
.quick a:hover { background: #f0f2f5; }
.quick a.active { background: var(--primary); color: #fff; }
@media (max-width: 860px) { .quick { margin-left: 0; } }

/* devices */
.card-highlight { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31, 95, 191, .12); }
.token { font-size: 1.1rem; padding: 12px; background: #f8f9fb; border: 1px dashed var(--border); border-radius: 6px; overflow-wrap: anywhere; user-select: all; }
.steps { margin: 0; padding-left: 20px; }
.steps li + li { margin-top: 6px; }
.copy { background: #f0f2f5; padding: 1px 6px; border-radius: 4px; user-select: all; }
.break { overflow-wrap: anywhere; }
.code { background: #1d2330; color: #e6e9ef; padding: 14px 16px; border-radius: 6px; overflow-x: auto; font-size: .85rem; }
.danger-zone { border-top: 1px solid var(--border); padding-top: 16px; }
.danger-zone input { max-width: 240px; }

@media (max-width: 860px) { .nav-public { display: flex; flex-basis: auto; flex-direction: row; padding: 0; margin-left: auto; } .nav-public .nav-user { border: 0; padding: 0; flex-direction: row; } }

/* uploads */
.upload-list { list-style: none; margin: 12px 0 0; padding: 0; }
.upload-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.upload-list progress { width: 160px; }
.upload-note { color: var(--muted); flex-basis: 100%; }
.upload-ok .upload-note { color: var(--ok-text); }
.upload-error .upload-note { color: var(--danger); }

/* story editor: the photos and videos */
.media-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.media-item { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: #f8f9fb; }
.media-item img, .media-item video { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #1d2330; }
.media-meta { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.media-meta form { display: flex; flex-direction: column; gap: 6px; margin: 0; }

/* map markers for photos and videos */
.media-marker { border: 2px solid #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.45); background: #1d2330; cursor: pointer; }
.media-marker img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-marker span { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; color: #fff; font-size: 18px; }

/* the visitors' pages */
.hero { text-align: center; padding: 24px 0 32px; }
.hero h1 { font-size: 2.2rem; }
.hero p { color: var(--muted); font-size: 1.1rem; margin: 0; }
.trip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.trip-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; color: inherit; text-decoration: none; transition: box-shadow .15s; }
.trip-card:hover { box-shadow: 0 6px 20px rgba(29, 35, 48, .12); }
.trip-card img, .trip-card-blank { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: linear-gradient(135deg, #2b3445, #e8590c); }
.trip-card-body { padding: 14px 18px; }
.trip-card-body h2 { margin: 0 0 4px; }
.trip-card-body p { margin: 4px 0 0; }

.story { max-width: 1000px; margin: 0 auto; }
.story-head { border-radius: var(--radius); margin-bottom: 20px; padding: 32px 0 8px; }
.story-head-cover { min-height: 340px; display: flex; align-items: flex-end; padding: 0; background-size: cover; background-position: center; color: #fff; overflow: hidden; }
.story-head-cover .story-head-text { width: 100%; padding: 64px 28px 24px; background: linear-gradient(transparent, rgba(0, 0, 0, .7)); }
.story-head h1 { font-size: 2.2rem; margin: 0; }
.story-date { text-transform: uppercase; letter-spacing: .06em; font-size: .85rem; margin: 0 0 6px; opacity: .85; }
.story-summary { font-size: 1.15rem; margin: 8px 0 0; }
.story-body { font-size: 1.08rem; line-height: 1.7; max-width: 720px; margin: 24px auto; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.gallery-item { position: relative; display: block; border-radius: 6px; overflow: hidden; background: #1d2330; }
.gallery-item img, .gallery-item video { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; pointer-events: none; }
.gallery-video::after { content: "\25B6"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 48px; height: 48px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.gallery-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; font-size: .8rem; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.7)); }

/* full-screen viewer */
.lightbox { position: fixed; inset: 0; z-index: 2000; background: rgba(10, 12, 16, .95); display: flex; align-items: center; justify-content: center; }
.lightbox[hidden] { display: none; }
.lightbox-open { overflow: hidden; }
.lb-stage { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 48px 56px 64px; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox button { position: absolute; background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 50%; width: 44px; height: 44px; font-size: 28px; line-height: 1; cursor: pointer; }
.lightbox button:hover { background: rgba(255,255,255,.25); }
.lb-close { top: 12px; right: 12px; }
.lb-prev { left: 8px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 8px; top: 50%; transform: translateY(-50%); }
.lb-caption { position: absolute; bottom: 16px; left: 16px; right: 16px; text-align: center; color: #dfe3ea; font-size: .95rem; }
@media (max-width: 600px) { .lb-stage { padding: 56px 8px 64px; } .story-head h1, .hero h1 { font-size: 1.7rem; } }

/* stops */
.stop-marker { background: #1f5fbf; color: #fff; border: 2px solid #fff; border-radius: 6px; font: 700 12px/18px system-ui, sans-serif; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.stop-dot { display: inline-block; width: 18px; height: 18px; margin-right: 6px; border-radius: 4px; background: #1f5fbf; color: #fff; font: 700 11px/18px system-ui, sans-serif; text-align: center; }

/* weather */
.weather { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.weather-day { display: flex; gap: 10px; align-items: center; padding: 10px 14px; background: #f8f9fb; border: 1px solid var(--border); border-radius: 6px; }
.weather-icon { font-size: 1.9rem; line-height: 1; }
.story-section { margin: 24px 0; }

/* story editor: choosing the part of the route */
.map-editor { height: 420px; min-height: 0; border-radius: 6px; border: 1px solid var(--border); }
.map-empty { height: auto; padding: 8px 12px; }
.route-sliders { display: grid; gap: 4px; margin-top: 8px; }
.route-slider { display: grid; grid-template-columns: 48px 1fr; align-items: center; gap: 8px; font-weight: 600; }
.route-slider input { width: 100%; }
.popup-actions { display: flex; gap: 6px; margin-top: 8px; }

/* device page: set up the app with a QR code */
.setup { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.setup-qr { background: #fff; padding: 10px; border: 1px solid var(--border); border-radius: 6px; line-height: 0; }
.setup .steps { flex: 1; min-width: 240px; }
