﻿/* ============================================
   JOMEAT — Modern Redesign
   ============================================ */

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

[hidden] { display: none !important; }

:root {
  --primary:        #059669;
  --primary-dark:   #047857;
  --primary-light:  #D1FAE5;
  --accent:         #F59E0B;
  --accent-light:   #FEF3C7;
  --bg:             #F0FDF4;
  --surface:        #FFFFFF;
  --text:           #0F172A;
  --text-secondary: #475569;
  --text-muted:     #94A3B8;
  --border:         #D1D5DB;
  --border-light:   #F3F4F6;
  --star-gold:      #F59E0B;
  --star-light:     #FEF3C7;
  --green:          #10B981;
  --green-light:    #D1FAE5;
  --red:            #EF4444;
  --red-light:      #FEE2E2;
  --radius-sm:      12px;
  --radius-md:      18px;
  --radius-lg:      28px;
  --radius-full:    999px;
  --transition:     0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- HEADER --- */
.header {
  background: linear-gradient(160deg, #047857 0%, #059669 40%, #34D399 100%);
  padding: 36px 20px 32px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.header::before {
  content: "";
  position: absolute;
  top: -80px;
  right: -60px;
  width: 220px;
  height: 220px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}

.header::after {
  content: "";
  position: absolute;
  bottom: -50px;
  left: -40px;
  width: 160px;
  height: 160px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
}

.header-inner {
  position: relative;
  z-index: 1;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 6px;
}

.logo-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.15));
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.logo-text {
  font-size: 1.8rem;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

.tagline {
  color: rgba(255,255,255,0.8);
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.2px;
}

/* --- MAIN --- */
.main {
  padding: 20px 16px 48px;
  max-width: 560px;
  margin: 0 auto;
}

/* --- LOCATION BAR --- */
.location-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  border: 1px solid var(--border);
}

.location-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.loc-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: all var(--transition);
}

.loc-dot.active    { background: var(--green); box-shadow: 0 0 0 5px var(--green-light); }
.loc-dot.searching { background: var(--star-gold); animation: pulse 1.2s infinite; }
.loc-dot.error     { background: var(--red); box-shadow: 0 0 0 5px var(--red-light); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.4); }
}

.btn-refresh {
  background: var(--border-light);
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.btn-refresh:hover  { background: var(--primary-light); color: var(--primary); }
.btn-refresh:active { transform: scale(0.9); }

/* --- CONTROL CARD --- */
.control-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  border: 1px solid var(--border);
}

.control-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.control-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.1px;
}

.control-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 5px 14px;
  border-radius: var(--radius-full);
  letter-spacing: 0.2px;
}

/* --- SLIDER --- */
.slider-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* --- DUAL RANGE SLIDER --- */
.range-slider-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.range-slider-track {
  flex: 1;
  position: relative;
  height: 6px;
}

.range-slider {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: transparent;
  outline: none;
  pointer-events: none;
  top: 0;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  pointer-events: auto;
  border: 3px solid #FFFFFF;
  box-shadow: 0 2px 10px rgba(5,150,105,0.4), 0 0 0 1px rgba(5,150,105,0.1);
  transition: all var(--transition);
  position: relative;
  z-index: 2;
}

.range-slider::-webkit-slider-thumb:hover  { transform: scale(1.1); box-shadow: 0 4px 16px rgba(5,150,105,0.5); }
.range-slider::-webkit-slider-thumb:active { transform: scale(1.2); }

.range-slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  pointer-events: auto;
  border: 3px solid #FFFFFF;
  box-shadow: 0 2px 10px rgba(5,150,105,0.4);
}

.range-slider-track::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--primary-light), var(--border));
}

.slider-end {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 34px;
  text-align: center;
}

.slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--primary-light), var(--border));
  outline: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 3px solid #FFFFFF;
  box-shadow: 0 2px 10px rgba(5,150,105,0.4), 0 0 0 1px rgba(5,150,105,0.1);
  transition: all var(--transition);
}

.slider::-webkit-slider-thumb:hover  { transform: scale(1.1); box-shadow: 0 4px 16px rgba(5,150,105,0.5); }
.slider::-webkit-slider-thumb:active { transform: scale(1.2); }

.slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 3px solid #FFFFFF;
  box-shadow: 0 2px 10px rgba(5,150,105,0.4);
}

/* --- FILTER CHIPS --- */
.filter-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.chip {
  padding: 6px 13px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
  letter-spacing: 0.1px;
}

.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
}

.chip.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #FFFFFF;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(5,150,105,0.35);
}

/* --- STAR RATING FILTER --- */
.star-filter-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.star-chip {
  flex: 1;
  padding: 11px 6px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  -webkit-user-select: none;
  user-select: none;
}

.star-chip:hover {
  border-color: var(--star-gold);
  color: var(--star-gold);
  background: var(--star-light);
  transform: translateY(-1px);
}

.star-chip.active {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #FFFFFF;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(245,158,11,0.4);
}

/* --- SORT TOGGLE --- */
.sort-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.sort-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-right: 2px;
}

.sort-toggle {
  flex: 1;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  -webkit-user-select: none;
  user-select: none;
}

.sort-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.sort-toggle.active {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(5,150,105,0.2);
}

/* --- SEARCH BUTTON --- */
.btn-search {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #059669, #34D399);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 6px 24px rgba(5,150,105,0.35);
  margin-bottom: 24px;
  letter-spacing: -0.2px;
  position: relative;
  overflow: hidden;
}

.btn-search::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  pointer-events: none;
}

.btn-search:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(5,150,105,0.45);
}

.btn-search:active { transform: scale(0.97); }

.btn-search:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 4px 14px rgba(5,150,105,0.2);
}

.search-note {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: -16px;
  margin-bottom: 16px;
}

/* --- RESULTS SECTION --- */
.results-section { min-height: 100px; }

/* --- SKELETON LOADING --- */
.loading {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.skeleton-card {
  height: 120px;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
}

.skeleton-photo {
  width: 88px;
  height: 88px;
  border-radius: var(--radius-sm);
  background: var(--border-light);
  flex-shrink: 0;
}

.skeleton-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skeleton-line {
  height: 14px;
  border-radius: 7px;
  background: var(--border-light);
}

.skeleton-line:first-child { width: 70%; height: 16px; }
.skeleton-line:last-child  { width: 40%; margin-top: 4px; }

.skeleton-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(0,0,0,0.03) 50%, transparent 100%);
  animation: shimmer 1.8s infinite;
}

@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* --- EMPTY / ERROR STATE --- */
.empty-state, .error-state {
  text-align: center;
  padding: 48px 24px;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  opacity: 0.8;
}

.empty-state h3, .error-state h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p, .error-state p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* --- RESULTS GRID --- */
.results-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* --- RESULTS REMARK --- */
.results-remark {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 16px;
  padding: 8px 16px;
  background: var(--surface);
  border-radius: var(--radius-full);
  display: inline-block;
  width: 100%;
  border: 1px solid var(--border-light);
}

/* --- PLACE CARD --- */
.place-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  gap: 16px;
  align-items: flex-start;
  position: relative;
  overflow: hidden;
  opacity: 1;
  transform: translateY(0);
}

/* ----- Card entrance animation ----- */
.card-enter {
  opacity: 0;
  transform: translateY(24px);
  animation: cardSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes cardSlideIn {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ----- Photo with rating badge ----- */
.place-photo-wrap {
  position: relative;
  flex-shrink: 0;
  width: 88px;
  height: 88px;
}

.photo-rating-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(0,0,0,0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #FFFFFF;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}

.place-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--border);
  transition: all var(--transition);
}

.place-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(5,150,105,0.1);
  border-color: var(--primary-light);
}

.place-card:hover::before {
  background: linear-gradient(180deg, var(--primary), var(--accent));
}

.place-card:active { transform: scale(0.98); }

.place-photo {
  width: 88px;
  height: 88px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--border-light);
  display: block;
}

.place-photo-placeholder {
  width: 88px;
  height: 88px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  background: linear-gradient(135deg, #D1FAE5, #A7F3D0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
}

.place-info {
  flex: 1;
  min-width: 0;
}

.place-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.place-rating {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}

.star {
  color: var(--star-gold);
  font-size: 0.95rem;
  filter: drop-shadow(0 1px 2px rgba(245,158,11,0.3));
}

.place-reviews {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.place-price {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-left: auto;
}

.place-vicinity {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.place-footer {
  display: flex;
  align-items: center;
  gap: 10px;
}

.place-distance {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.place-open {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.place-open.now    { background: var(--green-light); color: var(--green); }
.place-open.closed { background: var(--red-light);  color: var(--red); }

/* --- MODAL --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  max-height: 88dvh;
  overflow-y: auto;
  animation: slideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.15);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-close {
  position: sticky;
  top: 14px;
  float: right;
  z-index: 10;
  margin-right: 14px;
  background: rgba(255,255,255,0.9);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-secondary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--primary-light);
  color: var(--primary);
  transform: rotate(90deg);
}

.modal-hero {
  width: 100%;
  height: 220px;
  background: linear-gradient(135deg, #D1FAE5, #A7F3D0);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-hero-placeholder {
  font-size: 5rem;
  opacity: 0.5;
}

.modal-body {
  padding: 24px 20px;
}

.modal-body h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 10px;
  letter-spacing: -0.4px;
  color: var(--text);
  line-height: 1.3;
}

.modal-rating-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.modal-rating {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
}

.modal-address {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.6;
}

.modal-open-badge {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 16px;
}

.modal-open-badge.open   { background: var(--green-light); color: var(--green); }
.modal-open-badge.closed { background: var(--red-light);  color: var(--red); }

.modal-actions {
  display: flex;
  gap: 12px;
}

.btn-modal {
  flex: 1;
  padding: 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.92rem;
  text-align: center;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.1px;
}

.btn-modal.primary {
  background: linear-gradient(135deg, var(--primary), #34D399);
  color: #FFFFFF;
  box-shadow: 0 4px 16px rgba(5,150,105,0.3);
}

.btn-modal.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(5,150,105,0.4);
}

.btn-modal.secondary {
  background: var(--border-light);
  color: var(--text);
}

.btn-modal.share {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.85rem;
  padding: 10px 14px;
  flex: 0.6;
}

.btn-modal.share:hover {
  background: #A7F3D0;
  transform: translateY(-1px);
}

.btn-modal.share:active { transform: scale(0.96); }

/* --- RESPONSIVE (desktop) --- */
@media (min-width: 600px) {
  .header {
    padding: 48px 20px 40px;
  }

  .logo-text { font-size: 2.1rem; }

  .main { padding: 28px 20px 64px; }

  .place-photo, .place-photo-placeholder {
    width: 100px;
    height: 100px;
  }

  .modal {
    border-radius: var(--radius-lg);
    margin: auto;
    max-height: 82vh;
  }

  .modal-overlay { align-items: center; }

  .btn-search { padding: 18px; font-size: 1.1rem; }
}
