/* ===== Camping Tracker — base styles ===== */

:root {
    --bg:        #f4f1ea;
    --surface:   #ffffff;
    --surface-2: #ebe5d8;
    --ink:       #2b2a26;
    --ink-muted: #6b6860;
    --accent:    #2d6a4f;
    --accent-2:  #40916c;
    --accent-ink:#f7fff3;
    --danger:    #b2382b;
    --warn:      #d08e19;
    --ok:        #2d7a4f;
    --border:    #d9d2c3;
    --radius:    10px;
    --shadow:    0 1px 2px rgba(0,0,0,.04), 0 2px 6px rgba(0,0,0,.04);
    --mono: ui-monospace,SFMono-Regular,Consolas,monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:        #161a14;
        --surface:   #1f2520;
        --surface-2: #28302a;
        --ink:       #ecebe4;
        --ink-muted: #9d9a91;
        --accent:    #52b788;
        --accent-2:  #74c69d;
        --accent-ink:#0f1a14;
        --border:    #333b33;
        --shadow:    0 1px 3px rgba(0,0,0,.3);
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-text-size-adjust: 100%;
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code { font-family: var(--mono); background: var(--surface-2); padding: .1rem .3rem; border-radius: 4px; }

.muted { color: var(--ink-muted); }
.small { font-size: .85rem; }
.empty { color: var(--ink-muted); font-style: italic; padding: 1.5rem; text-align: center; }
.inline { display: inline; }
.link { color: var(--accent); font-weight: 500; }

/* ===== Layout ===== */

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 1rem;
}

@media (min-width: 768px) {
    .container { padding: 1.5rem; }
}

/* ===== Nav ===== */

.nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .75rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
    flex-wrap: wrap;
}
.nav-brand {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-weight: 700;
    color: var(--ink);
    text-decoration: none;
}
.nav-brand-icon { font-size: 1.3rem; }
.nav-brand-text { font-size: 1.05rem; }

.nav-links {
    display: flex;
    gap: 1rem;
    margin-left: auto;
    flex-wrap: wrap;
}
.nav-links a {
    color: var(--ink-muted);
    text-decoration: none;
    padding: .3rem .2rem;
    border-bottom: 2px solid transparent;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a.active { color: var(--accent); border-bottom-color: var(--accent); }

.nav-logout { margin-left: auto; }
@media (min-width: 500px) { .nav-logout { margin-left: 0; } }

/* ===== Sections & cards ===== */

section { margin-bottom: 1.25rem; }

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}
.card-narrow { max-width: 440px; margin: 2rem auto; }
.card-accent { border-left: 4px solid var(--accent); }
.card-success { border-left: 4px solid var(--ok); }
.card-form summary {
    cursor: pointer;
    font-weight: 600;
    padding: .25rem 0;
    user-select: none;
}
.card-form[open] summary { margin-bottom: .75rem; }
.card-header { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.card-title { margin: 0; font-size: 1.05rem; }

.grid { display: grid; gap: 1rem; }
.grid-2 {
    grid-template-columns: 1fr;
}
@media (min-width: 600px) {
    .grid-2 { grid-template-columns: 1fr 1fr; }
}

.card-link {
    display: block;
    color: var(--ink);
    text-decoration: none;
    transition: transform .08s ease;
}
.card-link:hover {
    text-decoration: none;
    transform: translateY(-1px);
    border-color: var(--accent);
}
.card-link h3 { color: var(--accent); }

/* ===== Forms ===== */

.form { display: grid; gap: 1rem; }
.form label { display: block; }
.form label > span { display: block; font-size: .9rem; font-weight: 500; margin-bottom: .25rem; }
.form .checkbox { display: flex; align-items: center; gap: .5rem; font-weight: normal; }
.form .checkbox > span { display: inline; margin: 0; font-weight: normal; }

.form-row {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr 1fr;
}
.form-actions {
    display: flex;
    gap: .5rem;
    justify-content: flex-end;
    margin-top: .5rem;
}

input[type=text], input[type=email], input[type=password], input[type=url],
input[type=date], input[type=number], select, textarea {
    width: 100%;
    padding: .55rem .7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    background: var(--surface);
    color: var(--ink);
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
    border-color: var(--accent);
}
textarea { resize: vertical; min-height: 70px; }

/* ===== Buttons ===== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    padding: .55rem 1rem;
    border: 1px solid transparent;
    border-radius: 8px;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    background: var(--surface-2);
    color: var(--ink);
    text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(0.97); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--border); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: .3rem .6rem; font-size: .85rem; }
.btn-block { width: 100%; }

/* ===== Pills / tags ===== */

.pill {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: .8rem;
    background: transparent;
    color: var(--ink-muted);
    cursor: pointer;
}
.pill-on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pill-off { color: var(--ink-muted); }

.tag {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 500;
    background: var(--surface-2);
    color: var(--ink-muted);
    text-transform: capitalize;
}
.tag-active    { background: var(--accent); color: var(--accent-ink); }
.tag-planning  { background: #f0e4c4; color: #6b5919; }
.tag-completed { background: #d4e8db; color: #1d4d32; }
.tag-archived  { background: var(--surface-2); color: var(--ink-muted); }
.tag-custom    { background: #ecd3f0; color: #5b2768; }

/* ===== Flash ===== */

.flash-stack { margin-bottom: 1rem; display: grid; gap: .5rem; }
.flash {
    display: flex;
    justify-content: space-between;
    align-items: start;
    padding: .7rem 1rem;
    border-radius: 8px;
    background: var(--surface);
    border-left: 4px solid var(--ink-muted);
}
.flash-success { border-color: var(--ok); background: #e8f4ec; color: #173f28; }
.flash-error   { border-color: var(--danger); background: #fbe8e4; color: #4a0f08; }
.flash-info    { border-color: var(--accent); background: #e4efeb; color: #1a3e2a; }
.flash-close {
    background: transparent; border: none; font-size: 1.3rem;
    cursor: pointer; line-height: 1; color: inherit; opacity: .6;
}
.flash-close:hover { opacity: 1; }

/* ===== Trip list ===== */

.trip-list {
    list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem;
}
.trip-list li > a {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .5rem;
    align-items: center;
    padding: .75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
}
.trip-list li > a:hover { border-color: var(--accent); text-decoration: none; }
.trip-name { font-weight: 600; }
.trip-meta {
    grid-column: 1 / -1;
    font-size: .85rem;
    margin-top: .2rem;
}

/* ===== Trip header / progress ===== */

.trip-header {
    display: grid;
    gap: .75rem;
    margin-bottom: 1rem;
}
@media (min-width: 720px) {
    .trip-header { grid-template-columns: 1fr auto; align-items: start; }
}
.trip-notes { white-space: pre-wrap; margin-top: .5rem; color: var(--ink-muted); }
.trip-status-actions { display: flex; flex-wrap: wrap; gap: .35rem; }

.progress-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .85rem 1rem;
    margin-bottom: 1rem;
}
.progress-label { margin-bottom: .4rem; font-size: .95rem; }
.progress-bar {
    height: 8px;
    background: var(--surface-2);
    border-radius: 999px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--accent);
    transition: width .3s ease;
}

/* ===== Categories + gear/check lists ===== */

.category { margin-top: 1.25rem; }
.category-name {
    font-size: 1rem;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: .5rem;
    padding-bottom: .2rem;
    border-bottom: 1px solid var(--border);
}

.gear-list, .checklist {
    list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem;
}

.gear-row {
    display: flex; gap: .75rem; align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .6rem .8rem;
    flex-wrap: wrap;
}
.gear-main { flex: 1 1 auto; min-width: 12rem; }
.gear-actions { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.gear-row.archived { opacity: .55; }

/* Template browse list */
.template-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.template-row {
    display: flex;
    gap: .75rem;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .6rem .8rem;
}
.template-main { flex: 1 1 auto; min-width: 0; }

/* ===== Checklist (pack-off UI) ===== */

.check-row {
    display: flex;
    gap: .5rem;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .25rem .5rem;
    transition: background .12s;
}
.check-row.packed { background: #eaf3ec; border-color: #bcdcc4; }
.check-row.packed .check-name { text-decoration: line-through; color: var(--ink-muted); }

.check-form { flex: 1 1 auto; min-width: 0; }
.check-btn {
    display: flex;
    gap: .7rem;
    align-items: center;
    width: 100%;
    padding: .5rem .3rem;
    background: transparent;
    border: none;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
    min-height: 44px; /* touch target */
}
.check-box {
    flex-shrink: 0;
    width: 26px; height: 26px;
    border: 2px solid var(--border);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--accent-ink);
    background: var(--surface);
}
.check-row.packed .check-box { background: var(--accent); border-color: var(--accent); }
.check-name { font-weight: 500; }

.check-actions { display: flex; gap: .25rem; align-items: center; flex-shrink: 0; }
.rating-select {
    font-size: .75rem;
    padding: .2rem .3rem;
    width: auto;
    min-width: 8rem;
}

/* ===== Installer ===== */

.installer .container { max-width: 560px; }

.install-steps {
    display: flex;
    justify-content: space-between;
    list-style: none;
    padding: 0;
    margin: 1rem 0 1.5rem;
    gap: .35rem;
    counter-reset: step;
}
.install-steps li {
    flex: 1;
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .85rem;
    color: var(--ink-muted);
    padding: .4rem .25rem;
    border-top: 3px solid var(--border);
}
.install-steps li.done    { color: var(--ink); border-color: var(--accent-2); }
.install-steps li.cur     { color: var(--ink); border-color: var(--accent); font-weight: 600; }
.install-steps .num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--surface-2);
    font-size: .75rem;
}
.install-steps li.done .num, .install-steps li.cur .num {
    background: var(--accent);
    color: var(--accent-ink);
}

.preflight { list-style: none; padding: 0; margin: 0; }
.preflight li {
    display: grid;
    grid-template-columns: 1.5rem 1fr auto;
    gap: .5rem;
    padding: .35rem 0;
    border-bottom: 1px dashed var(--border);
}
.preflight li:last-child { border: 0; }
.preflight .mark { font-weight: bold; }
.preflight .ok   .mark { color: var(--ok); }
.preflight .bad  .mark { color: var(--danger); }
.preflight .detail { font-family: var(--mono); color: var(--ink-muted); font-size: .85rem; }
