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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f4f5f7;
    color: #2c3e50;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ── Navbar ───────────────────────────────────────────────── */
.navbar {
    background: #1e293b;
    color: #f1f5f9;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,.3);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-brand {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: .5px;
    color: #f1f5f9;
    flex-shrink: 0;
}

.nav-center { flex: 1; display: flex; gap: 8px; }

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    flex-shrink: 0;
}

.nav-link {
    color: #94a3b8;
    font-size: .875rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color .15s, background .15s;
}
.nav-link:hover { color: #f1f5f9; background: rgba(255,255,255,.08); }

.nav-logout { color: #94a3b8; }

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.user-name { font-size: .875rem; color: #cbd5e1; }

/* ── Flash Messages ───────────────────────────────────────── */
.flash-container {
    max-width: 1200px;
    margin: 16px auto 0;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.flash {
    padding: 10px 16px;
    border-radius: 6px;
    font-size: .875rem;
}
.flash-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.flash-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 1.75rem; font-weight: 700; color: #1e293b; }

/* ── Login Page ───────────────────────────────────────────── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f4f5f7;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 48px 40px;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
    width: 100%;
    max-width: 380px;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
}

.login-subtitle {
    color: #64748b;
    margin-bottom: 32px;
    font-size: .95rem;
}

.btn-google {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: .9rem;
    font-weight: 500;
    color: #3c4043;
    cursor: pointer;
    transition: background .15s, box-shadow .15s;
    width: 100%;
    justify-content: center;
}
.btn-google:hover { background: #f8f9fa; box-shadow: 0 1px 4px rgba(0,0,0,.12); }

.google-icon { width: 18px; height: 18px; flex-shrink: 0; }

.btn-secondary {
    display: inline-block;
    margin-top: 16px;
    padding: 8px 20px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    color: #64748b;
    font-size: .875rem;
    transition: background .15s;
}
.btn-secondary:hover { background: #f1f5f9; }

/* ── Status Pages (pending/denied) ───────────────────────── */
.status-icon { font-size: 2.5rem; margin-bottom: 16px; }
.status-pending { color: #f59e0b; }
.status-denied  { color: #ef4444; }

/* ── Home — Tool Grid ─────────────────────────────────────── */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.tool-card {
    background: #fff;
    border-radius: 10px;
    padding: 28px 24px;
    border: 1px solid #e2e8f0;
    transition: box-shadow .15s, transform .15s;
    cursor: pointer;
}
.tool-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); transform: translateY(-2px); }
.tool-coming-soon { opacity: .7; cursor: default; }
.tool-coming-soon:hover { box-shadow: none; transform: none; }

.tool-icon { font-size: 2rem; margin-bottom: 12px; }
.tool-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; color: #1e293b; }
.tool-card p  { font-size: .85rem; color: #64748b; line-height: 1.5; margin-bottom: 12px; }

.badge-coming-soon {
    display: inline-block;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    background: #f1f5f9;
    color: #94a3b8;
    border-radius: 4px;
    padding: 2px 8px;
}

/* ── Admin — Users Table ──────────────────────────────────── */
.user-section { margin-bottom: 40px; }

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
}
.section-pending { color: #b45309; }

.user-table {
    width: 100%;
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    border-collapse: collapse;
    overflow: hidden;
}

.user-table th {
    background: #f8fafc;
    text-align: left;
    padding: 10px 16px;
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
}

.user-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    font-size: .875rem;
    vertical-align: middle;
}

.user-table tr:last-child td { border-bottom: none; }

.user-cell { display: flex; align-items: center; gap: 10px; }

.table-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: .75rem;
    font-weight: 600;
}
.status-approved { background: #d1fae5; color: #065f46; }
.status-pending  { background: #fef3c7; color: #92400e; }
.status-denied   { background: #fee2e2; color: #991b1b; }

.role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: .75rem;
    font-weight: 600;
    background: #ede9fe;
    color: #5b21b6;
}

.role-select {
    font-size: .8rem;
    padding: 3px 6px;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #1e293b;
    cursor: pointer;
}

.action-cell { display: flex; gap: 6px; align-items: center; }
.inline-form  { display: inline; }

.btn {
    padding: 4px 12px;
    border-radius: 4px;
    border: none;
    font-size: .8rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn-approve { background: #10b981; color: #fff; }
.btn-deny    { background: #ef4444; color: #fff; }

/* ── Coffee Explorer ──────────────────────────────────────── */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-label { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: #64748b; }
.filter-select {
    font-size: .875rem;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #1e293b;
    cursor: pointer;
    min-width: 110px;
}
.filter-select:focus { outline: 2px solid #3b82f6; outline-offset: 1px; }

.filter-clear {
    align-self: flex-end;
    font-size: .8rem;
    color: #64748b;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    transition: background .15s;
    white-space: nowrap;
}
.filter-clear:hover { background: #f1f5f9; color: #1e293b; }

.results-meta {
    font-size: .875rem;
    color: #64748b;
    margin-bottom: 16px;
}

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

.shop-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: box-shadow .15s;
}
.shop-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.07); }
.card-avoid { border-left: 3px solid #ef4444; }

.shop-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.shop-name { font-size: .95rem; font-weight: 600; color: #1e293b; line-height: 1.3; }
.shop-city { font-size: .78rem; color: #94a3b8; margin-top: 2px; }

.shop-badges { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 9999px; font-size: .72rem; font-weight: 600; white-space: nowrap; }
.badge-avoid { background: #fee2e2; color: #991b1b; }
.badge-drive { background: #f1f5f9; color: #475569; }

.shop-today-hours {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .82rem;
    font-weight: 500;
}
.hours-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot-open   { background: #10b981; }
.dot-closed { background: #94a3b8; }

.shop-hours { font-size: .78rem; color: #64748b; line-height: 1.4; }

.shop-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: .72rem; font-weight: 500; }
.tag-food    { background: #fef3c7; color: #92400e; }
.tag-outdoor { background: #d1fae5; color: #065f46; }
.tag-seating { background: #ede9fe; color: #5b21b6; }

.shop-notes { font-size: .8rem; color: #475569; line-height: 1.5; font-style: italic; }
.shop-address { font-size: .75rem; color: #94a3b8; margin-top: auto; }

.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: #94a3b8;
    font-size: .95rem;
}

/* ── Coffee form & edit controls ─────────────────────────── */
.page-header-row { display: flex; align-items: center; justify-content: space-between; }
.btn-add {
    padding: 8px 16px;
    background: #3b82f6;
    color: #fff;
    border-radius: 6px;
    font-size: .875rem;
    font-weight: 500;
    transition: background .15s;
}
.btn-add:hover { background: #2563eb; }

.shop-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; gap: 8px; }
.shop-address { font-size: .75rem; color: #94a3b8; }
.edit-link { font-size: .75rem; color: #3b82f6; white-space: nowrap; flex-shrink: 0; }
.edit-link:hover { text-decoration: underline; }

.back-link { font-size: .875rem; color: #64748b; display: inline-block; margin-bottom: 8px; }
.back-link:hover { color: #1e293b; }

.shop-form {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 28px 32px;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.form-section { display: flex; flex-direction: column; gap: 14px; }
.form-section-title {
    font-size: .95rem;
    font-weight: 600;
    color: #1e293b;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}
.form-section-hint { font-size: .78rem; font-weight: 400; color: #94a3b8; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.form-grid-days { grid-template-columns: repeat(7, 1fr); }
.form-full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: .8rem; font-weight: 500; color: #475569; }
.form-group input,
.form-group select,
.form-group textarea {
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: .875rem;
    color: #1e293b;
    background: #fff;
    font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: 2px solid #3b82f6; outline-offset: 1px; border-color: transparent; }
.form-group textarea { resize: vertical; }

.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 4px; }
.btn-save {
    padding: 9px 20px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
}
.btn-save:hover { background: #2563eb; }
.btn-delete {
    padding: 9px 20px;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
}
.btn-delete:hover { background: #dc2626; }

/* ── Location bar ─────────────────────────────────────────── */
.location-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 16px;
    margin-bottom: 10px;
    font-size: .875rem;
}

.location-label { font-weight: 600; color: #475569; white-space: nowrap; }

.location-options { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.loc-btn {
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #475569;
    font-size: .8rem;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.loc-btn:hover  { background: #f1f5f9; border-color: #94a3b8; }
.loc-btn.active { background: #1e293b; border-color: #1e293b; color: #fff; }

.loc-divider { color: #94a3b8; font-size: .8rem; }

.loc-custom-form { display: flex; gap: 6px; }
.loc-input {
    padding: 4px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: .8rem;
    width: 220px;
    color: #1e293b;
}
.loc-input:focus { outline: 2px solid #3b82f6; outline-offset: 1px; border-color: transparent; }

.location-status { font-size: .78rem; color: #64748b; }

.badge-drive-estimated { background: #e0f2fe; color: #0369a1; }

/* ── Google lookup bar ────────────────────────────────────── */
.lookup-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 20px;
    max-width: 800px;
}

.lookup-input {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: .875rem;
    color: #1e293b;
}
.lookup-input:focus { outline: 2px solid #3b82f6; outline-offset: 1px; border-color: transparent; }

.btn-lookup {
    padding: 8px 16px;
    background: #0ea5e9;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
}
.btn-lookup:hover    { background: #0284c7; }
.btn-lookup:disabled { background: #94a3b8; cursor: default; }

.lookup-status { font-size: .8rem; }

/* ── Lookup results dropdown ──────────────────────────────── */
.lookup-input-row { display: flex; gap: 10px; width: 100%; }
.lookup-input-row .lookup-input { flex: 1; }

.lookup-results {
    list-style: none;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
    overflow: hidden;
    margin-top: 4px;
    width: 100%;
}

.lookup-result-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background .12s;
}
.lookup-result-item:last-child { border-bottom: none; }
.lookup-result-item:hover { background: #f8fafc; }

.result-name    { font-size: .875rem; font-weight: 600; color: #1e293b; }
.result-address { font-size: .78rem; color: #64748b; }

/* ── Mobile (≤ 640px) ─────────────────────────────────────── */
@media (max-width: 640px) {

    /* Navbar */
    .nav-container { padding: 0 16px; gap: 12px; }
    .user-name { display: none; }
    .nav-link  { padding: 4px 6px; }

    /* Main content */
    .main-content { padding: 20px 16px; }

    /* Page header */
    .page-header { margin-bottom: 18px; }
    .page-header h1 { font-size: 1.4rem; }

    /* Location bar */
    .location-bar { padding: 10px 12px; gap: 8px; }
    .location-options { width: 100%; }
    .loc-custom-form { flex: 1; }
    .loc-input { width: auto; flex: 1; min-width: 0; }

    /* Filter bar */
    .filter-bar { padding: 12px 14px; gap: 10px; }
    .filter-group { flex: 1 1 calc(50% - 5px); min-width: 0; }
    .filter-select { min-width: 0; width: 100%; }
    .filter-clear { align-self: center; }

    /* Shop grid — single column, tighter padding */
    .shop-grid { grid-template-columns: 1fr; gap: 12px; }
    .shop-card { padding: 14px 16px; }

    /* Home tool grid */
    .tool-grid { grid-template-columns: 1fr; }

    /* Login card */
    .login-card { padding: 36px 24px; margin: 16px; }

    /* Shop form */
    .shop-form { padding: 20px 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-full { grid-column: 1; }
    .form-grid-days { grid-template-columns: repeat(4, 1fr); }

    /* Lookup bar */
    .lookup-bar { padding: 12px 14px; }
    .lookup-input-row { flex-direction: column; }
    .btn-lookup { width: 100%; }

    /* Admin table — horizontal scroll */
    .user-section { overflow-x: auto; }
    .user-table { min-width: 600px; }
}
