/* ==========================================================================
   VisionFirst Eye Care – Location Map Styles  (v3 – color update + zip finder)
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --vf-primary: #003349;
  --vf-primary-dark: #002236;
  --vf-primary-light: #e4eef4;
  --vf-accent: #00b4d8;
  --vf-accent-glow: rgba(0,180,216,.18);
  --vf-success: #22c55e;
  --vf-bg: #f6f8fb;
  --vf-white: #ffffff;
  --vf-text: #1a1f36;
  --vf-text-mid: #475569;
  --vf-text-light: #94a3b8;
  --vf-border: #e5e9f0;
  --vf-border-light: #f1f4f8;
  --vf-radius: 14px;
  --vf-radius-sm: 10px;
  --vf-radius-xs: 6px;
  --sidebar-width: 420px;
  --vf-shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --vf-shadow-md: 0 4px 14px rgba(0,0,0,.08);
  --vf-shadow-lg: 0 8px 30px rgba(0,0,0,.12);
  --vf-transition: .22s cubic-bezier(.4,0,.2,1);
}

/* ---------- Scoped reset ---------- */
#vf-map-app, #vf-map-app * { box-sizing: border-box; margin: 0; padding: 0; }

#vf-map-app {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--vf-text);
  display: flex;
  width: 100%;
  height: 100%;                /* fill whatever the parent gives us (iframe or page) */
  min-height: 500px;           /* safety floor */
  border-radius: 0;            /* no radius when filling an iframe edge-to-edge */
  overflow: hidden;
  box-shadow: none;            /* iframe border-radius handles rounding */
  background: var(--vf-bg);
  flex: 1;                     /* grow into flex parent (.vf-page-wrapper) */
}

/* ========================== SIDEBAR ========================== */
#vf-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: var(--vf-white);
  border-right: 1px solid var(--vf-border);
  z-index: 2;
}

/* ---- Header (v3.4 – centered, premium) ---- */
.vf-sidebar-header {
  padding: 30px 28px 26px;
  background: linear-gradient(145deg, var(--vf-primary) 0%, #001a28 60%, #00263c 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
  text-align: center;
}

/* Decorative glow orbs */
.vf-sidebar-header::before {
  content: '';
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,180,216,.10) 0%, transparent 70%);
  top: -100px;
  left: -60px;
  pointer-events: none;
}

.vf-sidebar-header::after {
  content: '';
  position: absolute;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.06) 0%, transparent 70%);
  bottom: -80px;
  right: -30px;
  pointer-events: none;
}

/* Eye icon above title */
.vf-header-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.12);
  backdrop-filter: blur(6px);
  position: relative;
}

.vf-header-icon svg {
  width: 22px;
  height: 22px;
  fill: #fff;
  opacity: .95;
}

.vf-sidebar-header h2 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 6px;
  position: relative;
  line-height: 1.2;
}

/* Subtle divider line under title */
.vf-header-divider {
  width: 36px;
  height: 2.5px;
  margin: 0 auto 10px;
  border-radius: 2px;
  background: rgba(0,180,216,.5);
  position: relative;
}

.vf-sidebar-header p {
  font-size: .82rem;
  font-weight: 400;
  opacity: .7;
  position: relative;
  letter-spacing: .01em;
}

/* ---- Location count pill ---- */
.vf-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
  padding: 6px 16px;
  border-radius: 20px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.10);
  backdrop-filter: blur(6px);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .03em;
  position: relative;
}

/* ---- Search box (v3.2 – oversized, stunning, no icon) ---- */
.vf-search-wrap {
  padding: 22px 22px;
  background: var(--vf-white);
  border-bottom: 1px solid var(--vf-border-light);
}

.vf-search-wrap input {
  width: 100%;
  height: 66px;
  padding: 0 28px;
  border: 2.5px solid var(--vf-border);
  border-radius: 33px;
  font-family: inherit;
  font-size: 1.18rem;
  font-weight: 600;
  color: var(--vf-text);
  text-align: center;
  outline: none;
  background: var(--vf-white);
  box-shadow: 0 4px 20px rgba(0,51,73,.07), 0 1px 4px rgba(0,0,0,.04);
  transition: border-color .25s ease, box-shadow .25s ease, background-color .25s ease, transform .18s ease;
}

.vf-search-wrap input::placeholder {
  color: var(--vf-text-light);
  font-weight: 500;
  font-size: 1.05rem;
  text-align: center;
}

.vf-search-wrap input:hover {
  border-color: #b8c5d3;
  box-shadow: 0 6px 24px rgba(0,51,73,.10), 0 2px 6px rgba(0,0,0,.05);
  transform: translateY(-1px);
}

.vf-search-wrap input:focus {
  border-color: var(--vf-primary);
  background-color: var(--vf-white);
  box-shadow: 0 0 0 4px rgba(0,51,73,.12), 0 6px 24px rgba(0,51,73,.10);
  transform: translateY(-1px);
}

/* ---- Distance result banner ---- */
.vf-distance-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: linear-gradient(135deg, #e4eef4 0%, #d6eaf8 100%);
  border-bottom: 1px solid var(--vf-border);
  font-size: .82rem;
  color: var(--vf-text);
  line-height: 1.45;
  animation: vf-slide-in .3s ease;
}

@keyframes vf-slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.vf-distance-banner .vf-dist-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--vf-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
}

.vf-distance-banner .vf-dist-text strong {
  color: var(--vf-primary);
  font-weight: 700;
}

.vf-distance-banner .vf-dist-miles {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--vf-accent);
}

.vf-distance-banner .vf-dist-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--vf-text-light);
  padding: 2px 4px;
  border-radius: 4px;
  transition: color var(--vf-transition);
  flex-shrink: 0;
}

.vf-distance-banner .vf-dist-close:hover {
  color: var(--vf-text);
}

/* Distance badge on location cards */
.vf-loc-distance {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  font-size: .68rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  background: #dbeafe;
  color: #1e40af;
  vertical-align: middle;
}

/* ---- Location list ---- */
.vf-location-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
  padding: 6px 0;
}

.vf-location-list::-webkit-scrollbar { width: 5px; }
.vf-location-list::-webkit-scrollbar-track { background: transparent; }
.vf-location-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ---- Location card item ---- */
.vf-location-item {
  margin: 4px 12px;
  padding: 14px 16px;
  border-radius: var(--vf-radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--vf-transition);
  position: relative;
}

/* Separator between location items */
.vf-location-item::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 20px;
  right: 20px;
  height: 1.5px;
  background: linear-gradient(90deg, transparent 0%, rgba(0,51,73,.25) 15%, rgba(0,51,73,.3) 50%, rgba(0,51,73,.25) 85%, transparent 100%);
  box-shadow: 0 1px 2px rgba(0,51,73,.06);
  pointer-events: none;
}
.vf-location-item:last-child::after {
  display: none;
}

.vf-location-item:hover {
  background: var(--vf-primary-light);
  border-color: rgba(0,51,73,.12);
  transform: translateX(2px);
}

.vf-location-item.active {
  background: var(--vf-primary-light);
  border-color: var(--vf-primary);
  box-shadow: 0 2px 10px rgba(0,51,73,.1);
}

/* Active indicator bar */
.vf-location-item.active::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 10px;
  bottom: 10px;
  width: 3.5px;
  border-radius: 0 3px 3px 0;
  background: var(--vf-primary);
}

/* Nearest location highlight */
.vf-location-item.nearest {
  border-color: var(--vf-accent);
  background: #e0f7fa;
  box-shadow: 0 2px 10px rgba(0,180,216,.12);
}

.vf-loc-name {
  font-weight: 700;
  font-size: .92rem;
  color: var(--vf-text);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -.01em;
  flex-wrap: wrap;
}

.vf-loc-address {
  font-size: .8rem;
  color: var(--vf-text-mid);
  line-height: 1.45;
  font-weight: 400;
}

/* Open / Closed status chip */
.vf-loc-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-size: .7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  letter-spacing: .02em;
}

.vf-loc-status.open {
  background: #dcfce7;
  color: #166534;
}

.vf-loc-status.closed {
  background: #fee2e2;
  color: #991b1b;
}

/* State badges */
.vf-loc-state-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.vf-badge-ky { background: #dbeafe; color: #1e40af; }
.vf-badge-in { background: #fef3c7; color: #92400e; }

/* No results */
.vf-no-results {
  padding: 40px 24px;
  text-align: center;
  color: var(--vf-text-light);
  font-size: .9rem;
  font-weight: 500;
}

.vf-no-results::before {
  content: '🔍';
  display: block;
  font-size: 2rem;
  margin-bottom: 10px;
}

/* ========================== MAP ========================== */
#vf-map-container {
  flex: 1;
  position: relative;
}

#vf-map {
  width: 100%;
  height: 100%;
}

/* ========================== INFO WINDOW ========================== */
.vf-info-window {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  max-width: 330px;
  padding: 2px 0;
}

.vf-info-window h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--vf-primary);
  margin-bottom: 10px;
  letter-spacing: -.02em;
  line-height: 1.3;
}

.vf-info-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 7px;
  font-size: .84rem;
  color: var(--vf-text);
  line-height: 1.5;
}

.vf-info-row svg { flex-shrink: 0; margin-top: 3px; color: var(--vf-primary); }

.vf-info-row a {
  color: var(--vf-primary);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--vf-transition);
}

.vf-info-row a:hover { color: var(--vf-accent); }

/* Hours section header */
.vf-hours-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 10px 0 6px;
  font-size: .82rem;
  font-weight: 700;
  color: var(--vf-text);
  letter-spacing: -.01em;
}

.vf-hours-header svg { color: var(--vf-primary); }

/* Hours table */
.vf-hours-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .78rem;
  margin: 4px 0 14px;
  border-radius: var(--vf-radius-xs);
  overflow: hidden;
}

.vf-hours-table td {
  padding: 4.5px 10px 4.5px 0;
}

.vf-hours-table tr { border-bottom: 1px solid var(--vf-border-light); }
.vf-hours-table tr:last-child { border-bottom: none; }

.vf-hours-table td:first-child {
  font-weight: 600;
  text-transform: capitalize;
  color: var(--vf-text-mid);
  width: 100px;
}

.vf-hours-table td:last-child {
  color: var(--vf-text-mid);
  font-weight: 400;
}

.vf-hours-table tr.today td {
  color: var(--vf-primary) !important;
  font-weight: 700 !important;
}

.vf-hours-table tr.today td:last-child::after {
  content: ' ← today';
  font-size: .68rem;
  font-weight: 600;
  color: var(--vf-accent);
  margin-left: 4px;
}

.vf-hours-table tr.closed td:last-child {
  color: #dc2626;
  font-weight: 500;
}

/* Buttons in info window */
.vf-info-buttons {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.vf-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: var(--vf-radius-sm);
  font-family: inherit;
  font-size: .82rem;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all var(--vf-transition);
  white-space: nowrap;
  letter-spacing: -.01em;
}

.vf-btn svg { flex-shrink: 0; }

.vf-btn-primary {
  background: linear-gradient(135deg, var(--vf-primary) 0%, var(--vf-primary-dark) 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,51,73,.25);
}

.vf-btn-primary:hover {
  background: linear-gradient(135deg, #004d6e 0%, var(--vf-primary) 100%);
  box-shadow: 0 4px 14px rgba(0,51,73,.35);
  transform: translateY(-1px);
  color: #fff;
}

.vf-btn-outline {
  background: var(--vf-white);
  color: var(--vf-primary);
  border: 1.5px solid var(--vf-border);
  box-shadow: var(--vf-shadow-sm);
}

.vf-btn-outline:hover {
  border-color: var(--vf-primary);
  background: var(--vf-primary-light);
  box-shadow: var(--vf-shadow-md);
  transform: translateY(-1px);
}

/* ========================== MOBILE TOGGLE ========================== */
#vf-mobile-toggle {
  display: none;
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  padding: 14px 28px;
  border-radius: 30px;
  background: linear-gradient(135deg, var(--vf-primary) 0%, var(--vf-primary-dark) 100%);
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: .9rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,51,73,.45);
  transition: all var(--vf-transition);
  letter-spacing: -.01em;
  -webkit-tap-highlight-color: transparent;
}

#vf-mobile-toggle:active {
  transform: translateX(-50%) scale(.96);
  box-shadow: 0 2px 12px rgba(0,51,73,.35);
}

/* ========================== TABLET (≤ 1024px) ========================== */
@media (max-width: 1024px) {
  :root { --sidebar-width: 360px; }

  .vf-search-wrap input {
    height: 58px;
    font-size: 1.05rem;
    border-radius: 29px;
  }
}

/* ========================== MOBILE (≤ 768px) ========================== */
@media (max-width: 768px) {
  /* --- Page-level overrides --- */
  .vf-page-wrapper { padding: 0 !important; }
  .vf-page-title { display: none; }

  /* --- App container: full-screen stacked --- */
  #vf-map-app {
    flex-direction: column;
    height: 100vh;
    height: 100dvh;       /* dynamic viewport for mobile browsers */
    border-radius: 0;
    box-shadow: none;
    position: relative;
    overflow: hidden;
  }

  /* --- Map takes all space --- */
  #vf-map-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
  }

  /* --- Toggle button visible --- */
  #vf-mobile-toggle { display: block; }

  /* --- Sidebar = bottom sheet --- */
  #vf-sidebar {
    width: 100%;
    min-width: 100%;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 65vh;
    max-height: 65dvh;
    z-index: 5;
    border-right: none;
    border-top: none;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -4px 30px rgba(0,0,0,.18);
    transition: transform .35s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* Collapsed: slide entire sidebar off-screen, only show toggle button */
  #vf-sidebar.collapsed {
    transform: translateY(100%);
    pointer-events: none;
  }
  #vf-sidebar.collapsed .vf-sidebar-header {
    pointer-events: auto;
  }

  /* --- Header: compact on mobile --- */
  .vf-sidebar-header {
    padding: 22px 20px 14px;
    border-radius: 22px 22px 0 0;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }

  /* Hide decorative orbs on mobile, repurpose ::before as drag handle */
  .vf-sidebar-header::before {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,.45);
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    bottom: auto; right: auto;
  }
  .vf-sidebar-header::after { display: none; }

  /* Compact icon on mobile */
  .vf-header-icon {
    width: 34px;
    height: 34px;
    margin-bottom: 10px;
    border-radius: 10px;
  }
  .vf-header-icon svg { width: 18px; height: 18px; }
  .vf-header-divider { width: 28px; height: 2px; margin-bottom: 8px; }

  .vf-sidebar-header h2 { font-size: 1.1rem; }
  .vf-sidebar-header p { font-size: .75rem; }
  .vf-count-pill { font-size: .68rem; margin-top: 8px; padding: 5px 12px; }

  /* --- Search: smaller on mobile --- */
  .vf-search-wrap {
    padding: 14px 16px;
    flex-shrink: 0;
  }

  .vf-search-wrap input {
    height: 50px;
    padding: 0 20px;
    border-radius: 25px;
    font-size: .95rem;
    font-weight: 500;
    border-width: 2px;
    box-shadow: 0 2px 10px rgba(0,0,0,.05);
  }

  .vf-search-wrap input::placeholder { font-size: .88rem; }

  /* --- Distance banner compact --- */
  .vf-distance-banner {
    padding: 10px 14px;
    font-size: .78rem;
    flex-shrink: 0;
  }

  .vf-distance-banner .vf-dist-icon {
    width: 28px; height: 28px;
    font-size: .78rem;
  }

  /* --- Location list: scrollable within remaining space --- */
  .vf-location-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: 8px;
  }

  .vf-location-item {
    margin: 4px 10px;
    padding: 12px 14px;
  }

  .vf-loc-name { font-size: .88rem; }
  .vf-loc-address { font-size: .78rem; }

  /* --- Info window: fit mobile --- */
  .vf-info-window { max-width: 280px; }
  .vf-info-window h3 { font-size: .95rem; }
  .vf-info-row { font-size: .8rem; }
  .vf-hours-table { font-size: .74rem; }

  .vf-info-buttons { flex-direction: column; }
  .vf-btn {
    justify-content: center;
    padding: 12px 16px;
    font-size: .84rem;
    min-height: 44px;     /* touch target */
  }
}

/* ========================== SMALL MOBILE (≤ 414px) ========================== */
@media (max-width: 414px) {
  .vf-sidebar-header { padding: 18px 16px 12px; }
  .vf-sidebar-header h2 { font-size: 1rem; }
  .vf-header-icon { width: 30px; height: 30px; margin-bottom: 8px; border-radius: 8px; }
  .vf-header-icon svg { width: 16px; height: 16px; }
  .vf-header-divider { width: 24px; margin-bottom: 6px; }

  .vf-search-wrap { padding: 12px 12px; }

  .vf-search-wrap input {
    height: 46px;
    font-size: .9rem;
    padding: 0 16px;
    border-radius: 23px;
  }

  .vf-search-wrap input::placeholder { font-size: .82rem; }

  .vf-location-item {
    margin: 3px 8px;
    padding: 11px 12px;
  }

  .vf-loc-name { font-size: .84rem; gap: 6px; }
  .vf-loc-address { font-size: .75rem; }
  .vf-loc-status { font-size: .66rem; }
  .vf-loc-state-badge { font-size: .6rem; padding: 2px 5px; }
}

/* ========================== VERY SMALL (≤ 320px) ========================== */
@media (max-width: 320px) {
  .vf-sidebar-header { padding: 16px 12px 10px; }
  .vf-sidebar-header h2 { font-size: .92rem; }
  .vf-header-icon { display: none; }
  .vf-header-divider { display: none; }
  .vf-count-pill { font-size: .62rem; padding: 3px 8px; }

  .vf-search-wrap input {
    height: 42px;
    font-size: .84rem;
    padding: 0 14px;
  }

  .vf-location-item { margin: 2px 6px; padding: 10px 10px; }
  .vf-loc-name { font-size: .8rem; }
}
