/* Admin-only styles (loaded after styles.css). */
body.admin { background: #eef0e8; height: auto; min-height: 100%; }

.form-grid.one-col { grid-template-columns: 1fr; }

/* Schedule modal */
.add-hours { border: 1px solid rgba(27,58,31,0.15); border-radius: 12px; padding: 14px; background: #fbfcf8; margin-bottom: 16px; }
.add-hours h3 { margin: 0 0 10px; font-size: 15px; }
.ah-times { display: flex; gap: 14px; margin-bottom: 4px; }
.ah-times label { display: flex; flex-direction: column; font-size: 12.5px; color: var(--muted); gap: 4px; }
.ah-times input { padding: 8px 10px; border: 1px solid rgba(27,58,31,0.2); border-radius: 8px; font-size: 14px; }
#ah-loc { width: 100%; padding: 9px 10px; border: 1px solid rgba(27,58,31,0.2); border-radius: 8px; font-size: 14px; background: #fff; }
/* Google Places autocomplete dropdown must sit above the admin overlay (z 60). */
.pac-container { z-index: 100000 !important; }
.ah-newloc { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.ah-newloc input { padding: 9px 10px; border: 1px solid rgba(27,58,31,0.2); border-radius: 8px; font-size: 14px; }
#ah-resolved { color: var(--green-700); }
#ah-cal { max-width: 320px; margin: 4px 0 10px; }
#ah-add { width: 100%; }

.all-hours-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 10px; }
.all-hours-title { font-size: 15px; margin: 0; }
.all-hours { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.ah-item { display: grid; grid-template-columns: 1fr auto 1fr auto auto; gap: 10px; align-items: center; font-size: 13.5px; padding: 8px 10px; background: #fff; border: 1px solid rgba(27,58,31,0.1); border-radius: 8px; }
.ah-item .ah-when { font-weight: 600; }
.ah-item .ah-time { color: var(--green-700); font-weight: 600; white-space: nowrap; }
.ah-item .ah-loc-name { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ah-edit { border: 1px solid rgba(27,58,31,0.2); background: #fff; color: var(--green-900); border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: 12.5px; font-weight: 600; }
.ah-del { border: none; background: rgba(192,57,43,0.1); color: var(--red); width: 26px; height: 26px; border-radius: 50%; cursor: pointer; font-size: 13px; }
.ah-loc-existing { margin-top: 8px; }
@media (max-width: 560px) { .ah-item { grid-template-columns: 1fr auto auto; grid-row-gap: 2px; } .ah-item .ah-loc-name { grid-column: 1 / -1; } }

/* Admin as an overlay on the main app */
.admin-overlay { position: fixed; inset: 0; z-index: 60; overflow-y: auto; background: #eef0e8; }
body.admin-open { overflow: hidden; } /* freeze the map behind */
.admin-x { position: absolute; top: 14px; right: 14px; border: none; background: rgba(27,58,31,0.06); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 15px; color: var(--ink); }

.btn-primary { border: none; background: var(--green-700); color: #fff; padding: 9px 16px; border-radius: 10px; font-weight: 700; font-size: 14px; cursor: pointer; }
.btn-primary:hover { background: var(--green-900); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.btn-ghost { border: 1px solid rgba(27,58,31,0.2); background: #fff; color: var(--green-900); padding: 9px 14px; border-radius: 10px; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn-ghost:hover { border-color: var(--green-300); }
.btn-danger { border: none; background: var(--red); color: #fff; padding: 9px 16px; border-radius: 10px; font-weight: 700; font-size: 14px; cursor: pointer; }
.btn-danger-ghost { border: 1px solid rgba(192,57,43,0.35); background: #fff; color: var(--red); padding: 9px 14px; border-radius: 10px; font-weight: 600; font-size: 14px; cursor: pointer; }

/* ---------- Gate ---------- */
.gate { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #dfe7d2, #eef0e8); }
.gate-card { background: #fff; padding: 32px; border-radius: 18px; box-shadow: var(--shadow-lg); width: min(360px, calc(100vw - 32px)); text-align: center; }
.gate-card .brand { font-size: 28px; margin: 0 0 4px; }
.brand small { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }
.gate-sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.gate-card input { width: 100%; padding: 12px 14px; border: 1px solid rgba(27,58,31,0.2); border-radius: 10px; font-size: 16px; margin-bottom: 12px; }
.gate-card button { width: 100%; border: none; background: var(--green-700); color: #fff; padding: 12px; border-radius: 10px; font-weight: 700; font-size: 15px; cursor: pointer; }
.gate-error { color: var(--red); font-size: 13px; min-height: 18px; margin: 10px 0 0; }
.gate-status { font-size: 12.5px; line-height: 1.4; margin: 10px 0 0; }
.gate-status.bad { color: var(--amber); }
.gate-status.ok { color: var(--green-700); }

/* ---------- Editor ---------- */
.editor { max-width: 860px; margin: 0 auto; padding: 20px 16px 60px; }
.ed-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.ed-header .brand { font-size: 24px; margin: 0; }
.ed-header-actions { display: flex; align-items: center; gap: 10px; }
.save-state { font-size: 13px; color: var(--green-700); font-weight: 600; }
.save-state.error { color: var(--red); }

.ed-list { display: flex; flex-direction: column; gap: 10px; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }
.ed-row { display: flex; align-items: center; gap: 14px; background: #fff; border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); }
.ed-logo { width: 54px; height: 54px; border-radius: 12px; background: var(--green-300) center/cover no-repeat; flex-shrink: 0; }
.ed-row-info { flex: 1; min-width: 0; }
.ed-row-info h3 { margin: 0 0 3px; font-size: 16px; }
.ed-row-info p { margin: 0; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-row-actions { display: flex; gap: 8px; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center; background: rgba(27,58,31,0.45); padding: 24px 16px; overflow-y: auto; }
.modal-card { background: #fff; border-radius: 18px; padding: 24px; width: min(760px, 100%); box-shadow: var(--shadow-lg); position: relative; margin: auto; }
.modal-card.narrow { width: min(420px, 100%); }
.modal-card h2 { margin: 0 0 16px; font-size: 20px; }
.modal-close { position: absolute; top: 14px; right: 14px; border: none; background: rgba(27,58,31,0.06); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 15px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.form-col { display: flex; flex-direction: column; }
.fl { font-size: 12.5px; font-weight: 700; color: var(--muted); margin: 12px 0 5px; text-transform: uppercase; letter-spacing: 0.4px; }
.fl:first-child { margin-top: 0; }
.form-col input[type=text], .form-col input[type=url] { width: 100%; padding: 10px 12px; border: 1px solid rgba(27,58,31,0.2); border-radius: 10px; font-size: 15px; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }

.photo-row { display: flex; gap: 14px; align-items: center; }
.photo-preview { width: 82px; height: 82px; border-radius: 16px; background: #e4ebd8 center/cover no-repeat; flex-shrink: 0; border: 2px dashed rgba(27,58,31,0.2); }
.photo-preview.empty::after { content: '🍵'; display: flex; align-items: center; justify-content: center; height: 100%; font-size: 28px; opacity: 0.5; }
.photo-actions { display: flex; flex-direction: column; gap: 4px; }

.pick-map { width: 100%; height: 220px; border-radius: 12px; overflow: hidden; background: #dfe4d6; }
.pick-map-err { padding: 16px; font-size: 13px; color: var(--muted); }
.pick-pin { width: 18px; height: 18px; border-radius: 50% 50% 50% 0; background: var(--green-700); border: 3px solid #fff; transform: rotate(-45deg); box-shadow: 0 2px 5px rgba(0,0,0,0.35); }
.latlng { display: flex; gap: 8px; }
.latlng input { flex: 1; padding: 9px 10px; border: 1px solid rgba(27,58,31,0.2); border-radius: 10px; font-size: 13px; }

/* Schedule */
.sched-section { margin-top: 22px; border-top: 1px solid rgba(27,58,31,0.1); padding-top: 16px; }
.sched-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sched-head h3 { margin: 0; font-size: 16px; }
.sched-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; }
.sum-row { display: flex; justify-content: space-between; font-size: 13.5px; padding: 3px 0; border-bottom: 1px dotted rgba(27,58,31,0.12); }
.sum-day { color: var(--ink); font-weight: 600; }
.sum-row.open .sum-hours { color: var(--green-700); font-weight: 600; }
.sum-row.closed .sum-hours { color: var(--red); }
.sum-row.unset .sum-hours { color: var(--muted); }
.sum-note { grid-column: 1 / -1; font-size: 12.5px; color: var(--amber); margin: 6px 0 0; }

/* Location cards */
.loc-list-admin { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.loc-card { border: 1px solid rgba(27,58,31,0.15); border-radius: 12px; padding: 12px; background: #fbfcf8; }
.loc-card.active { border-color: var(--green-300); box-shadow: 0 0 0 2px rgba(139,195,74,0.25); }
.loc-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.loc-card-head strong { font-size: 14px; }
.loc-card input[type=text], .loc-card input[type=number] { width: 100%; padding: 8px 10px; border: 1px solid rgba(27,58,31,0.2); border-radius: 8px; font-size: 14px; margin-bottom: 8px; }
.loc-card .latlng { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.loc-card .latlng input { margin-bottom: 0; }
.pill { border: 1px solid rgba(27,58,31,0.25); background: #fff; color: var(--green-900); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.pill.on { background: var(--green-700); color: #fff; border-color: var(--green-700); }
.btn-ghost.sm, .btn-danger-ghost.sm { padding: 6px 10px; font-size: 12.5px; }
.btn-danger-ghost.sm { margin-left: auto; }
.loc-hours-sum { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 4px; }
.loc-hours-sum .lh { font-size: 11.5px; color: var(--muted); }
.loc-hours-sum .lh b { color: var(--ink); }
.loc-hours-sum .lh.open { color: var(--green-700); }
.loc-hours-sum .lh.closed { color: var(--red); }

/* Menu item cards */
.menu-list-admin { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.empty-note { color: var(--muted); font-size: 13px; margin: 6px 0; }
.menu-item-card { display: flex; gap: 10px; align-items: flex-start; border: 1px solid rgba(27,58,31,0.15); border-radius: 12px; padding: 10px; background: #fbfcf8; }
.menu-thumb { width: 60px; height: 60px; border-radius: 10px; flex-shrink: 0; border: 1px dashed rgba(27,58,31,0.25); background: #eef0e8 center/cover no-repeat; cursor: pointer; font-size: 20px; }
.menu-thumb.empty { color: var(--muted); }
.menu-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.menu-fields-top { display: flex; gap: 8px; }
.menu-fields input, .menu-fields textarea { border: 1px solid rgba(27,58,31,0.2); border-radius: 8px; padding: 8px 10px; font-size: 14px; font-family: inherit; width: 100%; }
.menu-fields .price-input { max-width: 90px; flex-shrink: 0; }
.menu-fields textarea { resize: vertical; }

.modal-actions { display: flex; align-items: center; gap: 10px; margin-top: 22px; }
.modal-actions .spacer { flex: 1; }

/* Schedule calendar modal */
.sched-cal { max-width: 320px; margin: 0 auto; }
.sched-editor { margin-top: 16px; border-top: 1px solid rgba(27,58,31,0.1); padding-top: 14px; }
.sched-editor-day { font-weight: 700; margin-bottom: 10px; }
.closed-toggle, .apply-weekday { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 8px 0; cursor: pointer; }
.time-row { display: flex; gap: 14px; margin: 6px 0; }
.time-row label { display: flex; flex-direction: column; font-size: 12.5px; color: var(--muted); gap: 4px; }
.time-row input { padding: 8px 10px; border: 1px solid rgba(27,58,31,0.2); border-radius: 8px; font-size: 14px; }
.sched-editor-actions { display: flex; justify-content: space-between; margin-top: 14px; }

/* Cropper */
.crop-stage { display: flex; justify-content: center; }
#crop-canvas { width: 320px; height: 320px; border-radius: 12px; background: #222; touch-action: none; cursor: grab; }
#crop-canvas:active { cursor: grabbing; }
.zoom-row { display: flex; align-items: center; gap: 12px; margin: 14px 0 0; font-size: 13px; color: var(--muted); }
.zoom-row input { flex: 1; }

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .sched-summary { grid-template-columns: 1fr; }
}
