/* ================================================
   Christchurch Cafes — Design System
   Palette: Espresso, Cream, Copper, Sage
   ================================================ */

:root {
    --espresso:    #1C1008;
    --dark-roast:  #2E1B0E;
    --copper:      #B5651D;
    --copper-light:#D4834A;
    --cream:       #F5EDD8;
    --cream-mid:   #EDE0C4;
    --paper:       #E8D5B0;
    --sage:        #7A9E7E;
    --sage-light:  #A8C4AB;
    --steam:       #8C9BA8;
    --steam-light: #C4D0D9;
    --white:       #FEFCF8;
    --text-dark:   #1C1008;
    --text-mid:    #5C4A36;
    --text-light:  #8C7A66;

    --radius-sm: 4px;
    --radius:    8px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    --shadow-sm: 0 1px 3px rgba(28,16,8,0.08);
    --shadow:    0 4px 16px rgba(28,16,8,0.10);
    --shadow-lg: 0 8px 32px rgba(28,16,8,0.14);

    --font-display: 'Playfair Display', Georgia, serif;
    --font-body:    'Inter', system-ui, sans-serif;
    --font-mono:    'JetBrains Mono', monospace;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--cream);
    color: var(--text-dark);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ================================================
   SITE HEADER
   ================================================ */
.site-header {
    background: var(--espresso);
    color: var(--cream);
    padding: 0;
    position: relative;
    overflow: hidden;
}

/* Topographic backdrop — Port Hills contour map */

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 44px 24px 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    position: relative;
    z-index: 1;
}

/* Topographic backdrop */
.topo-backdrop {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}
.topo-svg {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 24px;
    position: relative;
    z-index: 1;
}

.brand-eyebrow {
    display: block;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--copper-light);
    margin-bottom: 4px;
}

.brand-name {
    font-family: var(--font-display);
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 700;
    line-height: 1.05;
    color: var(--white);
    letter-spacing: -0.01em;
}

.brand-sub {
    display: block;
    font-size: 13px;
    color: var(--steam-light);
    margin-top: 6px;
    font-style: italic;
    font-family: var(--font-display);
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-lg);
    padding: 20px 28px;
    flex-shrink: 0;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 24px;
}

.stat-num {
    font-family: var(--font-mono);
    font-size: 28px;
    font-weight: 500;
    color: var(--copper-light);
    line-height: 1;
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--steam);
    margin-top: 4px;
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: rgba(255,255,255,0.1);
}

/* ================================================
   FILTER BAR
   ================================================ */
.filter-bar {
    background: var(--white);
    border-bottom: 1px solid var(--cream-mid);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(28,16,8,0.06);
}

.filter-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.filter-form {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 12px 0;
}

.search-wrap {
    position: relative;
    margin-bottom: 10px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-light);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    background: var(--cream);
    border: 1px solid var(--cream-mid);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text-dark);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input:focus {
    outline: none;
    border-color: var(--copper);
    box-shadow: 0 0 0 3px rgba(181,101,29,0.12);
}

.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 13px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: color 0.15s;
}

.search-clear:hover { color: var(--text-dark); }

.filter-chips {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.filter-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    margin-right: 2px;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 13px;
    background: var(--cream);
    border: 1px solid var(--cream-mid);
    color: var(--text-mid);
    transition: all 0.15s;
    white-space: nowrap;
}

.chip:hover { border-color: var(--copper); color: var(--copper); }
.chip.active { background: var(--copper); border-color: var(--copper); color: var(--white); }
.chip.visited-chip.active { background: var(--sage); border-color: var(--sage); }

.filter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.sort-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.sort-select {
    padding: 4px 10px;
    border: 1px solid var(--cream-mid);
    border-radius: var(--radius);
    background: var(--cream);
    font-size: 13px;
    color: var(--text-mid);
    cursor: pointer;
}

/* ================================================
   MAIN CONTENT & CARD GRID
   ================================================ */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 24px 60px;
}

.results-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.results-count {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-light);
    letter-spacing: 0.03em;
}

.clear-all {
    margin-left: 12px;
    color: var(--copper);
    font-size: 12px;
    text-decoration: underline;
}

.cafe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* ================================================
   CAFE CARD
   ================================================ */
.cafe-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(28,16,8,0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.cafe-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.cafe-card.is-visited {
    border-left: 3px solid var(--sage);
}

.card-photo-wrap {
    position: relative;
    height: 180px;
    overflow: hidden;
    background: var(--cream-mid);
}

.card-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.cafe-card:hover .card-photo { transform: scale(1.03); }

.card-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cream);
    color: var(--text-light);
}

.card-photo-placeholder svg { width: 60px; height: 60px; }

.visited-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--sage);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 100px;
    letter-spacing: 0.04em;
}

.neighbourhood-badge {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(28,16,8,0.7);
    backdrop-filter: blur(4px);
    color: var(--cream);
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 100px;
    letter-spacing: 0.04em;
}

.card-body {
    padding: 18px 20px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cafe-name {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: var(--espresso);
    line-height: 1.2;
}

.cafe-address {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    font-size: 13px;
    color: var(--text-light);
}

.address-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    margin-top: 1px;
    color: var(--copper);
}

.cafe-desc {
    font-size: 13px;
    color: var(--text-mid);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid var(--cream-mid);
}

.card-link {
    font-size: 12px;
    color: var(--copper);
    font-weight: 500;
    transition: color 0.15s;
}

.card-link:hover { color: var(--dark-roast); }

.card-hours {
    font-size: 12px;
    color: var(--text-light);
    font-family: var(--font-mono);
}

/* ================================================
   RATINGS SECTION
   ================================================ */
.ratings-section {
    border-top: 1px solid var(--cream-mid);
    padding-top: 12px;
    margin-top: 4px;
}

.avg-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.stars { display: inline-flex; gap: 1px; }
.star.full  { color: var(--copper); }
.star.half  { color: var(--copper); opacity: 0.6; }
.star.empty { color: var(--cream-mid); }

.rating-count { font-size: 12px; color: var(--text-light); }

.btn-rate {
    font-size: 12px;
    font-weight: 500;
    color: var(--copper);
    background: none;
    border: 1px solid var(--copper);
    border-radius: var(--radius);
    padding: 4px 12px;
    transition: all 0.15s;
}

.btn-rate:hover { background: var(--copper); color: white; }

.rating-form-wrap {
    margin-top: 12px;
    background: var(--cream);
    border-radius: var(--radius);
    padding: 14px;
}

.rating-form { display: flex; flex-direction: column; gap: 8px; }

.star-picker { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; }
.star-picker input { display: none; }
.star-picker label {
    font-size: 22px;
    color: var(--cream-mid);
    cursor: pointer;
    transition: color 0.1s;
}
.star-picker input:checked ~ label,
.star-picker label:hover,
.star-picker label:hover ~ label { color: var(--copper); }

.form-input-sm {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--cream-mid);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: white;
}

.form-textarea-sm {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--cream-mid);
    border-radius: var(--radius-sm);
    font-size: 13px;
    resize: vertical;
    background: white;
}

.form-input-sm:focus, .form-textarea-sm:focus {
    outline: none;
    border-color: var(--copper);
}

.btn-submit-sm {
    align-self: flex-start;
    background: var(--espresso);
    color: var(--cream);
    border: none;
    border-radius: var(--radius);
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s;
}

.btn-submit-sm:hover { background: var(--dark-roast); }

.comment {
    border-top: 1px solid var(--cream-mid);
    padding-top: 10px;
    margin-top: 10px;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.comment-author { font-weight: 600; font-size: 12px; }
.comment-date { font-size: 11px; color: var(--text-light); font-family: var(--font-mono); }
.comment-text { font-size: 13px; color: var(--text-mid); }

/* ================================================
   EMPTY STATE
   ================================================ */
.empty-state {
    text-align: center;
    padding: 80px 24px;
    color: var(--text-mid);
}

.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h2 { font-family: var(--font-display); font-size: 24px; margin-bottom: 8px; }
.empty-state p { margin-bottom: 24px; color: var(--text-light); }

/* ================================================
   BUTTONS (global)
   ================================================ */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--copper);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: background 0.15s, transform 0.1s;
    text-decoration: none;
}

.btn-primary:hover { background: var(--copper-light); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary.btn-full { width: 100%; justify-content: center; }
.btn-primary.btn-large { padding: 12px 28px; font-size: 15px; }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    background: var(--cream);
    color: var(--text-dark);
    border: 1px solid var(--cream-mid);
    border-radius: var(--radius);
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 500;
    transition: border-color 0.15s;
    text-decoration: none;
}

.btn-secondary:hover { border-color: var(--copper); }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    background: transparent;
    color: var(--text-mid);
    border: 1px solid rgba(28,16,8,0.12);
    border-radius: var(--radius);
    padding: 9px 18px;
    font-size: 14px;
    transition: color 0.15s, border-color 0.15s;
    text-decoration: none;
}

.btn-ghost:hover { color: var(--text-dark); border-color: rgba(28,16,8,0.3); }

.btn-danger {
    background: #dc2626;
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s;
}

.btn-danger:hover { background: #b91c1c; }

/* ================================================
   SITE FOOTER
   ================================================ */
.site-footer {
    background: var(--espresso);
    color: var(--steam);
    padding: 24px 0;
    margin-top: 0;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-inner p { font-size: 13px; }

.admin-link {
    font-size: 12px;
    color: var(--steam);
    opacity: 0.5;
    transition: opacity 0.15s;
}

.admin-link:hover { opacity: 1; }

/* ================================================
   LOGIN PAGE
   ================================================ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--espresso);
}

.login-wrap {
    width: 100%;
    max-width: 380px;
    padding: 24px;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 40px 36px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-logo { width: 80px; margin: 0 auto 20px; }

.login-title {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 700;
    color: var(--espresso);
    margin-bottom: 4px;
}

.login-sub {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 28px;
    font-style: italic;
    font-family: var(--font-display);
}

.login-form .form-group {
    text-align: left;
    margin-bottom: 16px;
}

.login-form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-mid);
    margin-bottom: 6px;
}

.login-form input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--cream-mid);
    border-radius: var(--radius);
    font-size: 15px;
    background: var(--cream);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--copper);
    box-shadow: 0 0 0 3px rgba(181,101,29,0.12);
}

.login-hint {
    margin-top: 20px;
    font-size: 12px;
    color: var(--text-light);
    line-height: 1.7;
    background: var(--cream);
    border-radius: var(--radius);
    padding: 12px;
}

.login-hint code {
    background: var(--cream-mid);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 12px;
}

/* ================================================
   ALERTS
   ================================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 20px;
    border-left: 3px solid;
}

.alert-success { background: #f0fdf4; border-color: #22c55e; color: #15803d; }
.alert-error   { background: #fef2f2; border-color: #ef4444; color: #b91c1c; }
.alert-info    { background: #eff6ff; border-color: #3b82f6; color: #1d4ed8; }

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
        padding: 24px 20px;
    }

    .header-stats {
        width: 100%;
        justify-content: center;
        padding: 16px;
    }

    .stat { padding: 0 16px; }
    .stat-num { font-size: 22px; }

    .cafe-grid {
        grid-template-columns: 1fr;
    }

    .filter-chips { gap: 4px; }
    .chip { padding: 3px 10px; font-size: 12px; }

    .footer-inner { flex-direction: column; gap: 8px; text-align: center; }
}

@media (max-width: 480px) {
    .main-content { padding: 16px 16px 48px; }
    .filter-inner { padding: 0 16px; }
    .header-inner { padding: 20px 16px; }
    .coffee-ring-wrap { width: 64px; height: 64px; }
    .brand-name { font-size: 26px; }
}
