/* TripBay — clean light design system (devbay family) */
:root {
    --bg: #f8fafc;
    --bg-soft: #f1f5f9;
    --text: #0f172a;
    --text-dim: #64748b;
    --text-faint: #94a3b8;
    --card: #ffffff;
    --card-strong: #f8fafc;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --accent-1: #6366f1;
    --accent-2: #4f46e5;
    --accent-3: #818cf8;
    --accent-soft: rgba(99, 102, 241, 0.08);
    --good: #10b981;
    --danger: #ef4444;
    --radius: 0.625rem;
    --shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
    --shadow-hover: 0 4px 12px 0 rgba(15, 23, 42, 0.08);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC",
            "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-soft: #1e293b;
    --text: #f1f5f9;
    --text-dim: #94a3b8;
    --text-faint: #64748b;
    --card: #1e293b;
    --card-strong: #0f172a;
    --border: #334155;
    --border-strong: #475569;
    --accent-1: #818cf8;
    --accent-2: #a5b4fc;
    --accent-3: #6366f1;
    --accent-soft: rgba(129, 140, 248, 0.14);
    --shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 4px 12px 0 rgba(0, 0, 0, 0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    transition: background 0.3s ease, color 0.3s ease;
}

.container { width: min(1100px, 92vw); margin: 0 auto; }

/* ---------- header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-logo { display: flex; }
.brand-name { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; }
.brand-accent { color: var(--accent-1); }
.nav-right { display: flex; align-items: center; gap: 10px; }
.icon-btn {
    display: flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 0.5rem;
    background: var(--card); border: 1px solid var(--border);
    color: var(--text-dim); cursor: pointer; transition: all 0.15s ease;
    font-family: inherit;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--card-strong); }
.icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

.lang-select {
    appearance: none; -webkit-appearance: none;
    background: var(--card); border: 1px solid var(--border);
    border-radius: 0.5rem; color: var(--text-dim);
    font-family: inherit; font-size: 0.8rem; font-weight: 600;
    padding: 8px 28px 8px 12px; cursor: pointer; transition: all 0.15s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
}
.lang-select:hover { color: var(--text); border-color: var(--border-strong); }

/* ---------- hero ---------- */
.hero { text-align: center; padding: 64px 0 40px; }
.hero-title {
    font-size: clamp(2.2rem, 5.5vw, 3.4rem);
    font-weight: 900; letter-spacing: -0.03em; line-height: 1.15;
}
.grad-text { color: var(--accent-1); }
.hero-sub { max-width: 640px; margin: 18px auto 0; color: var(--text-dim); font-size: 1.05rem; }

/* ---------- buttons ---------- */
.btn {
    padding: 10px 20px;
    background: var(--accent-1); color: #fff;
    border: none; border-radius: 0.5rem;
    font-family: inherit; font-size: 0.92rem; font-weight: 700;
    cursor: pointer; transition: background 0.15s ease, transform 0.1s ease;
}
.btn:hover { background: var(--accent-2); }
.btn:active { transform: scale(0.98); }
.btn-small { padding: 8px 14px; font-size: 0.85rem; }
.btn-center { display: block; margin: 0 auto; }
.btn-ghost {
    padding: 10px 16px;
    background: var(--card); color: var(--text-dim);
    border: 1px solid var(--border); border-radius: 0.5rem;
    font-family: inherit; font-size: 0.92rem; font-weight: 600;
    cursor: pointer; transition: all 0.15s ease;
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); background: var(--card-strong); }

/* ---------- panels & form ---------- */
.panel {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 24px;
}
.panel h2 { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); margin-bottom: 18px; }

.form-panel { max-width: 640px; margin: 0 auto 28px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .field:first-child { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.88rem; font-weight: 600; color: var(--text-dim); margin-bottom: 5px; }
.input {
    width: 100%; padding: 10px 12px;
    background: var(--card-strong); border: 1px solid var(--border);
    border-radius: 0.5rem; color: var(--text);
    font-family: inherit; font-size: 0.95rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus { outline: none; border-color: var(--accent-1); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.select {
    width: 100%; padding: 10px 12px;
    appearance: none; -webkit-appearance: none;
    background: var(--card-strong); border: 1px solid var(--border);
    border-radius: 0.5rem; color: var(--text);
    font-family: inherit; font-size: 0.95rem; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.select:focus { outline: none; border-color: var(--accent-1); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- trips grid (home) ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.section-label { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); }

.trip-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px; padding: 16px 0 64px;
}
.trip-card {
    display: flex; flex-direction: column; gap: 8px;
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px 18px 16px;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.trip-card:hover { border-color: var(--accent-3); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.trip-card-top { display: flex; align-items: center; justify-content: space-between; }
.trip-type-icon { font-size: 1.4rem; line-height: 1; }
.trip-actions { display: flex; gap: 6px; opacity: 0; transition: opacity 0.15s ease; }
.trip-card:hover .trip-actions { opacity: 1; }
@media (hover: none) { .trip-actions { opacity: 1; } }
.mini-btn {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 0.4rem;
    background: var(--card-strong); border: 1px solid var(--border);
    color: var(--text-dim); cursor: pointer; transition: all 0.15s ease;
}
.mini-btn:hover { color: var(--text); border-color: var(--border-strong); }
.mini-btn.danger:hover { color: var(--danger); border-color: var(--danger); }
.trip-card-name { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }
.trip-card-meta { font-size: 0.85rem; color: var(--text-dim); }

.trip-progress { display: flex; flex-direction: column; gap: 5px; margin-top: 4px; }
.progress-track {
    height: 6px; border-radius: 999px;
    background: var(--bg-soft); border: 1px solid var(--border);
    overflow: hidden;
}
.progress-fill {
    height: 100%; border-radius: 999px;
    background: var(--accent-1);
    transition: width 0.3s ease;
}
.progress-label { font-size: 0.78rem; color: var(--text-faint); font-weight: 600; }

/* ---------- empty state ---------- */
.empty-state {
    text-align: center; padding: 56px 20px 72px;
    background: var(--card); border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
}
.empty-icon { font-size: 2.6rem; margin-bottom: 12px; }
.empty-state h2 { font-size: 1.2rem; color: var(--text); text-transform: none; letter-spacing: 0; margin-bottom: 6px; }
.empty-state p { color: var(--text-dim); font-size: 0.95rem; margin-bottom: 20px; }

/* ---------- trip detail ---------- */
.trip-page { padding: 24px 0 64px; }
.back-link {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--text-dim); text-decoration: none;
    font-size: 0.9rem; font-weight: 600; margin-bottom: 14px;
}
.back-link:hover { color: var(--accent-1); }

.trip-head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.trip-head h1 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); font-weight: 800; letter-spacing: -0.02em; }
.trip-meta { color: var(--text-dim); margin-top: 2px; font-size: 0.95rem; }
.trip-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.trip-summary {
    display: flex; align-items: center; gap: 14px;
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 16px 20px; margin-bottom: 20px;
}
.trip-summary-big {
    font-size: 1.7rem; font-weight: 900; letter-spacing: -0.02em;
    color: var(--accent-1); font-variant-numeric: tabular-nums; min-width: 68px;
}
.big-track { flex: 1; height: 10px; }
.trip-summary-label { color: var(--text-dim); font-size: 0.9rem; font-weight: 600; white-space: nowrap; }

.cat-list { display: flex; flex-direction: column; gap: 16px; }
.cat-card { padding: 18px 20px; }
.cat-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cat-head h2 { margin: 0; text-transform: none; letter-spacing: 0.02em; font-size: 0.95rem; color: var(--text); }
.cat-count { font-size: 0.78rem; font-weight: 700; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.cat-track { flex: 1; }

.cat-items { display: flex; flex-direction: column; }
.item-row {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 6px; border-radius: 0.45rem;
    cursor: pointer; transition: background 0.12s ease;
}
.item-row:hover { background: var(--card-strong); }
.item-row input[type="checkbox"] {
    width: 18px; height: 18px; accent-color: var(--accent-1); cursor: pointer;
    flex-shrink: 0;
}
.item-label { font-size: 0.95rem; flex: 1; }
.item-row.done .item-label { color: var(--text-faint); text-decoration: line-through; }
.item-del {
    display: flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 0.35rem;
    background: transparent; border: none;
    color: var(--text-faint); cursor: pointer;
    opacity: 0; transition: all 0.12s ease; flex-shrink: 0;
}
.item-row:hover .item-del { opacity: 1; }
@media (hover: none) { .item-del { opacity: 1; } }
.item-del:hover { color: var(--danger); background: var(--bg-soft); }

.add-item { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.add-item .input { flex: 1; }
.hidden-note { font-size: 0.78rem; color: var(--text-faint); margin-top: 8px; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 32px 0 40px; margin-top: 24px; }
.footer-inner { display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center; }
.footer-tag { color: var(--text-dim); font-size: 0.9rem; }
.footer-meta { color: var(--text-faint); font-size: 0.8rem; }

/* ---------- print ---------- */
@media print {
    .site-header, .site-footer, .no-print, .add-item { display: none !important; }
    body { background: #fff; color: #0f172a; }
    .container { width: 100%; }
    .trip-page { padding: 0; }
    .trip-head h1 { font-size: 1.5rem; }
    .trip-summary, .cat-card { border: 1px solid #cbd5e1; box-shadow: none; break-inside: avoid; }
    .progress-track { border: 1px solid #cbd5e1; }
    .item-row { padding: 4px 2px; }
    .item-row input[type="checkbox"] { accent-color: #6366f1; }
}
