/* Turistické známky — svěží "trail" styl (teal + jantarová) se světlým i tmavým režimem */

:root {
    --bg: #f2f7f5;
    --surface: #ffffff;
    --surface-2: #eef4f1;
    --border: #dde8e3;
    --text: #12211c;
    --text-muted: #5f7570;

    --primary: #0d9488;
    --primary-600: #0f766e;
    --primary-700: #115e59;
    --primary-soft: #d3f5ee;

    --accent: #f97316;
    --accent-600: #ea580c;
    --accent-soft: #ffe8d1;

    --danger: #dc2626;
    --danger-soft: #fde2e1;
    --success: #16a34a;
    --success-soft: #dcf5e2;

    --radius: 18px;
    --radius-sm: 12px;
    --shadow-sm: 0 1px 3px rgba(15, 35, 30, 0.08);
    --shadow: 0 10px 30px -12px rgba(13, 148, 136, 0.35);
    color-scheme: light;
    font-size: 16px;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0a1512;
        --surface: #101f1b;
        --surface-2: #142822;
        --border: #1f3830;
        --text: #eaf5f1;
        --text-muted: #8fa89e;

        --primary: #2dd4bf;
        --primary-600: #14b8a6;
        --primary-700: #0d9488;
        --primary-soft: #123832;

        --accent: #fb923c;
        --accent-600: #f97316;
        --accent-soft: #3a2410;

        --danger: #f87171;
        --danger-soft: #3a1616;
        --success: #4ade80;
        --success-soft: #123a22;

        --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.55);
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, "Segoe UI Variable", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

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

.page {
    max-width: 780px;
    margin: 0 auto;
    padding: 20px 16px 72px;
}

/* --- Top bar --- */

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    background:
        radial-gradient(circle at 15% -40%, rgba(45, 212, 191, 0.35), transparent 55%),
        linear-gradient(120deg, #0b2f2a, #0f172a 65%);
    color: #eafff9;
    padding: 12px 20px;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #f4fffb;
    text-decoration: none;
    font-weight: 800;
    letter-spacing: -0.01em;
    font-size: 1.05rem;
    white-space: nowrap;
}

.brand-logo {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.12);
}

.topnav {
    display: flex;
    gap: 4px;
    flex: 1;
}

.topnav a {
    color: #b8d9d1;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
}

.topnav a.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-700));
    color: #ffffff;
}
.topnav a:hover:not(.active) {
    background: rgba(255,255,255,0.08);
    color: #ffffff;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    white-space: nowrap;
}

.user-name { opacity: 0.85; font-weight: 600; }

/* --- Buttons --- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 11px 20px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-700));
    color: #ffffff;
    box-shadow: var(--shadow);
}
.btn-primary:hover { filter: brightness(1.06); }

.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-600));
    color: #fff8f1;
    box-shadow: 0 10px 26px -10px rgba(249, 115, 22, 0.55);
}
.btn-accent:hover { filter: brightness(1.05); }

.btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}

.btn-ghost {
    background: transparent;
    color: #eafff9;
    border-color: rgba(255,255,255,0.35);
}
.page .btn-ghost {
    color: var(--primary-700);
    border-color: var(--border);
    background: var(--surface);
}

.btn-danger { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }

.btn-sm { padding: 7px 14px; font-size: 0.83rem; }
.btn-block { display: flex; width: 100%; }

/* --- Cards / alerts --- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.92rem;
    font-weight: 600;
}
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--success); }

.empty-state {
    text-align: center;
    padding: 56px 16px;
    color: var(--text-muted);
}

/* --- Auth screens --- */

.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 20% 10%, rgba(13, 148, 136, 0.16), transparent 45%),
        radial-gradient(circle at 85% 90%, rgba(249, 115, 22, 0.14), transparent 45%),
        var(--bg);
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 24px 60px -20px rgba(13, 94, 89, 0.35);
    padding: 36px 30px;
    width: 100%;
    max-width: 360px;
    text-align: center;
}

.auth-logo { width: 68px; height: 68px; border-radius: 20px; margin-bottom: 10px; }
.auth-card h1 { margin: 4px 0; font-size: 1.35rem; letter-spacing: -0.01em; }
.auth-sub { color: var(--text-muted); margin-bottom: 22px; font-size: 0.9rem; }
.auth-form { text-align: left; }

/* --- Forms --- */

.form-row { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.form label { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.req { color: var(--accent); }

input[type="text"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="file"],
select {
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 1rem;
    color: var(--text);
    width: 100%;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.form-inline { display: block; }
.user-card-actions { margin-top: 4px; }

/* --- Collection head / tabs --- */

.collection-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 4px 0 18px;
    flex-wrap: wrap;
}
.collection-head h1 { margin: 0; font-size: 1.5rem; letter-spacing: -0.02em; }

.country-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 2px 10px;
    margin-bottom: 8px;
    -webkit-overflow-scrolling: touch;
}

.country-tab {
    flex: none;
    white-space: nowrap;
    padding: 9px 16px;
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.87rem;
    font-weight: 600;
    border: 1.5px solid var(--border);
    transition: transform 0.12s ease;
}
.country-tab:hover { transform: translateY(-1px); }
.country-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-700));
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 8px 20px -8px rgba(13, 148, 136, 0.5);
}
.country-tab .count { opacity: 0.75; font-size: 0.85em; }

.search-bar { margin-bottom: 14px; position: relative; }
.search-bar input {
    padding-left: 40px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f7570' stroke-width='2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>");
    background-repeat: no-repeat;
    background-position: 13px center;
    background-size: 18px;
}

/* --- Stamp list --- */

.stamp-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stamp-row {
    display: grid;
    grid-template-columns: 46px 56px 1fr auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 2px 12px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: border-color 0.15s ease, transform 0.1s ease;
}
.stamp-row:hover {
    border-left-color: var(--primary);
    transform: translateX(2px);
}

.stamp-thumb {
    grid-row: 1 / span 2;
    width: 46px; height: 46px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--primary-soft);
    display: flex; align-items: center; justify-content: center;
}
.stamp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.stamp-thumb-placeholder { color: var(--primary-600); font-weight: 800; }

.stamp-no {
    font-weight: 800;
    color: var(--primary-700);
    align-self: end;
    font-variant-numeric: tabular-nums;
}
.stamp-name {
    grid-column: 3;
    grid-row: 1;
    align-self: end;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.stamp-place {
    grid-column: 2 / span 2;
    grid-row: 2;
    color: var(--text-muted);
    font-size: 0.82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.stamp-chevron {
    grid-row: 1 / span 2;
    color: var(--text-muted);
    font-size: 1.2rem;
}

.stamp-detail {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin: -4px 0 4px;
}
.stamp-detail-inner { padding: 16px; }
.stamp-detail-photos { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.stamp-detail-photos img {
    width: 120px; height: 120px; object-fit: cover;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.stamp-desc { font-size: 0.88rem; color: var(--text); white-space: pre-line; }
.stamp-meta { font-size: 0.8rem; color: var(--text-muted); }

.no-results { text-align: center; color: var(--text-muted); padding: 32px; }

/* --- Add stamp lookup preview --- */

.lookup-status { font-size: 0.85rem; color: var(--text-muted); margin: -6px 0 14px; }

.lookup-preview {
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--primary-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 16px;
}
.lookup-preview img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; }
.lookup-preview-name { font-weight: 700; }
.lookup-preview-place { font-size: 0.85rem; color: var(--text-muted); }

/* --- Users --- */

.user-list { display: flex; flex-direction: column; gap: 10px; }
.user-card { display: flex; flex-direction: column; gap: 10px; }
