/**
 * Vicart Deli v2 - Main Stylesheet
 * Preserves existing design aesthetic from v1
 */

:root {
  --bg-page: #fff7fa;
  --bg-card: #ffffff;
  --bg-soft: #ffe9f1;
  --accent: #e11d48;
  --accent-soft: #f97316;
  --accent-strong: #b91c1c;
  --text-main: #1f2933;
  --text-muted: #374151;
  --border-soft: rgba(226, 232, 240, 0.9);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --shadow-soft: 0 24px 40px rgba(148, 27, 63, 0.18);
  --shadow-card: 0 18px 36px rgba(148, 27, 63, 0.14);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #ffe4e6, var(--bg-page));
  color: var(--text-main);
  min-height: 100vh;
}

/* ============================================================================
   Header
   ============================================================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  background: linear-gradient(to bottom, rgba(255, 247, 250, 0.96), rgba(255, 247, 250, 0.92));
  border-bottom: 1px solid rgba(248, 209, 221, 0.7);
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.logo-circle {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: radial-gradient(circle at top left, #ffedd5, #fb7185);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  box-shadow: 0 8px 18px rgba(248, 113, 113, 0.6);
  overflow: hidden;
}

.logo-circle img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-text h1 {
  font-size: 1.1rem;
  margin: 0;
}

.brand-text p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.9rem;
  transition: background-color 0.15s, color 0.15s;
}

.nav-link:hover {
  background-color: rgba(248, 209, 221, 0.8);
  color: var(--text-main);
}

.call-link {
  font-weight: 600;
}

.cart-button {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.9), #ffe4ec);
  cursor: pointer;
  font-size: 0.9rem;
}

.cart-icon {
  font-size: 1.1rem;
}

.cart-badge {
  background: var(--accent);
  color: #fff;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.cart-total {
  font-weight: 700;
}

/* ============================================================================
   Page Layout
   ============================================================================ */

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

/* ============================================================================
   Hero
   ============================================================================ */

.hero {
  margin-bottom: 2rem;
}

.hero-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
}

.hero-text h2 {
  font-size: 2rem;
  margin: 0 0 0.5rem;
}

.hero-text p {
  margin: 0 0 1rem;
  color: var(--text-muted);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(15, 23, 42, 0.12);
  font-size: 0.8rem;
}

.meta-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
}

.meta-link:hover {
  text-decoration: underline;
}

.hero-banner {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: radial-gradient(circle at 10% 0%, #ffe7d4, #fed7e2);
  box-shadow: var(--shadow-soft);
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================================
   Category Nav
   ============================================================================ */

.category-nav {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 0;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-soft);
}

.category-link {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  text-decoration: none;
  color: var(--text-main);
  font-size: 0.9rem;
  white-space: nowrap;
  transition: all 0.15s;
}

.category-link:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ============================================================================
   Loading & Error States
   ============================================================================ */

.loading-state,
.error-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.hidden {
  display: none !important;
}

/* ============================================================================
   Menu Grid
   ============================================================================ */

.menu-category {
  margin-bottom: 2.5rem;
}

.category-title {
  margin: 0 0 1rem;
  font-size: 1.5rem;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

/* ============================================================================
   Item Card
   ============================================================================ */

.item-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(248, 209, 221, 0.7);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: transform 0.15s, box-shadow 0.15s;
}

.item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 44px rgba(148, 27, 63, 0.18);
}

.item-card.item-unavailable {
  opacity: 0.6;
  filter: grayscale(0.1);
}

.item-card.flash-added {
  animation: flash-green 0.6s ease-out;
}

@keyframes flash-green {
  0% {
    border-color: rgba(248, 209, 221, 0.7);
  }

  20% {
    border-color: rgba(34, 197, 94, 0.9);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
  }

  100% {
    border-color: rgba(248, 209, 221, 0.7);
  }
}

.item-image {
  position: relative;
  width: 100%;
  height: 140px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: radial-gradient(circle at 0 0, #ffe4e6, #fee2e2);
}

.item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: #fee2e2;
  color: #b91c1c;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.item-badge.sale {
  background: #dcfce7;
  color: #166534;
}

.item-info {
  flex: 1;
}

.item-name {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.item-desc {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.item-price {
  margin-top: 0.5rem;
  font-weight: 600;
}

.price-original {
  text-decoration: line-through;
  color: var(--text-muted);
  font-weight: 400;
  margin-right: 0.5rem;
}

.price-current {
  color: var(--accent);
}

.intensity-toggle {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.intensity-btn {
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: #fff;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}

.intensity-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.item-actions {
  display: flex;
  justify-content: flex-end;
}

.qty-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #fff1f2;
  border-radius: 999px;
  padding: 0.25rem;
}

.qty-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--accent-strong);
}

.qty-btn.qty-sm {
  width: 26px;
  height: 26px;
  font-size: 0.9rem;
}

.qty-value {
  min-width: 24px;
  text-align: center;
  font-weight: 600;
}

/* ============================================================================
   Cart Sidebar
   ============================================================================ */

.cart-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 100%;
  background: var(--bg-card);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
  z-index: 200;
  display: flex;
  flex-direction: column;
}

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-soft);
}

.cart-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.cart-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}

.cart-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
}

.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-soft);
}

.cart-item-info {
  flex: 1;
}

.cart-item-name {
  display: block;
  font-weight: 500;
}

.cart-item-price {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.cart-footer {
  border-top: 1px solid var(--border-soft);
  padding: 1rem 1.25rem;
}

.promo-input-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.promo-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  font-size: 0.9rem;
}

.promo-status {
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.promo-status.success {
  color: #166534;
}

.promo-status.error {
  color: var(--accent-strong);
}

.cart-summary {
  margin: 0.75rem 0;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
  font-size: 0.9rem;
}

.summary-row.discount-row {
  color: #166534;
}

.summary-row.total-row {
  font-weight: 700;
  font-size: 1rem;
  border-top: 1px solid var(--border-soft);
  padding-top: 0.5rem;
  margin-top: 0.25rem;
}

.checkout-btn {
  width: 100%;
}

/* ============================================================================
   Buttons
   ============================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}

.btn-primary {
  background: linear-gradient(90deg, #f97316, #ea580c);
  color: #fff;
  box-shadow: 0 8px 20px rgba(249, 115, 22, 0.4);
}

.btn-primary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #fff;
  color: var(--text-main);
  border: 1px solid var(--border-soft);
}

.btn-secondary:hover {
  background: var(--bg-soft);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

/* ============================================================================
   Modal
   ============================================================================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
}

.modal-dialog {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: 1.5rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

/* ============================================================================
   Forms
   ============================================================================ */

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-family: inherit;
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-hint {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Phone verification */
.phone-verify-row {
  display: flex;
  gap: 0.5rem;
}

.phone-verify-row input {
  flex: 1;
}

.verify-status {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.verify-status.sending,
.verify-status.verifying {
  color: var(--text-muted);
}

.verify-status.code-sent {
  color: #1d4ed8;
}

.verify-status.verified {
  color: #166534;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.verify-status.error {
  color: #b91c1c;
}

.verify-code-group {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-soft);
  border-radius: var(--radius-md);
}

.verify-code-group label {
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
}

.verify-code-row {
  display: flex;
  gap: 0.5rem;
}

.verify-code-row input {
  flex: 1;
  text-align: center;
  font-size: 1.1rem;
  letter-spacing: 0.2em;
}

.payment-options {
  border: 1px dashed rgba(248, 180, 200, 0.9);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
}

.payment-options legend {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0 0.5rem;
}

.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-right: 1.5rem;
  cursor: pointer;
}

.order-summary {
  background: var(--bg-soft);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin: 1rem 0;
}

.summary-items {
  margin-bottom: 0.75rem;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
  font-size: 0.9rem;
}

.summary-totals .summary-row.total {
  font-weight: 700;
  border-top: 1px solid var(--border-soft);
  padding-top: 0.5rem;
  margin-top: 0.25rem;
}

.summary-totals .summary-row.discount {
  color: #166534;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

/* ============================================================================
   Confirmation Modal
   ============================================================================ */

.confirmation-dialog {
  text-align: center;
  padding: 2rem;
}

.confirmation-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #dcfce7;
  color: #166534;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin: 0 auto 1rem;
}

.confirmation-dialog h2 {
  margin: 0 0 0.5rem;
}

.order-number {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 0.5rem;
}

.confirmation-message {
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

.confirmation-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 1.25rem;
}

/* ============================================================================
   Floating Cart
   ============================================================================ */

.floating-cart {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
}

.floating-cart-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(225, 29, 72, 0.4);
}

.floating-cart-text {
  white-space: nowrap;
}

/* ============================================================================
   Toast
   ============================================================================ */

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  animation: slide-in 0.25s ease-out;
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast-info {
  border-left: 4px solid #3b82f6;
}

.toast-success {
  border-left: 4px solid #22c55e;
}

.toast-error {
  border-left: 4px solid #ef4444;
}

.toast-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--text-muted);
  margin-left: auto;
}

/* ============================================================================
   Footer
   ============================================================================ */

.site-footer {
  border-top: 1px solid rgba(248, 209, 221, 0.7);
  text-align: center;
  padding: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-meta a {
  color: var(--accent);
}

/* ============================================================================
   Track Page
   ============================================================================ */

.track-page {
  max-width: 600px;
}

.track-lookup {
  text-align: center;
  padding: 2rem 0;
}

.track-lookup h2 {
  margin: 0 0 0.5rem;
}

.track-lookup p {
  color: var(--text-muted);
  margin: 0 0 1.5rem;
}

.lookup-form {
  display: flex;
  gap: 0.5rem;
  max-width: 400px;
  margin: 0 auto;
}

.lookup-form input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  font-size: 1rem;
  text-transform: uppercase;
}

.lookup-hint {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--accent-strong);
}

.track-status {
  padding: 1rem 0;
}

.order-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.order-header h2 {
  margin: 0;
}

.order-status-badge {
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
}

.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-confirmed {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-preparing {
  background: #fce7f3;
  color: #be185d;
}

.status-ready {
  background: #dcfce7;
  color: #166534;
}

.status-completed {
  background: #f3f4f6;
  color: #6b7280;
}

.status-cancelled {
  background: #fee2e2;
  color: #b91c1c;
}

.status-timeline {
  position: relative;
  padding-left: 2rem;
  margin-bottom: 2rem;
}

.status-timeline::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-soft);
}

.timeline-step {
  position: relative;
  padding: 0.75rem 0;
}

.timeline-dot {
  position: absolute;
  left: -1.5rem;
  top: 1rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border-soft);
  border: 2px solid #fff;
}

.timeline-step.completed .timeline-dot {
  background: #22c55e;
}

.timeline-step.active .timeline-dot {
  background: var(--accent);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.4);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(225, 29, 72, 0);
  }
}

.timeline-label {
  font-weight: 500;
}

.timeline-time {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.order-details {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 1.5rem;
}

.order-details h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.order-items-list {
  margin-bottom: 0.75rem;
}

.order-item {
  display: flex;
  gap: 0.5rem;
  padding: 0.3rem 0;
  font-size: 0.9rem;
}

.item-qty {
  color: var(--text-muted);
}

.order-total {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  border-top: 1px solid var(--border-soft);
  padding-top: 0.5rem;
}

.track-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.connection-status {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d1d5db;
}

.connection-status.connected .status-dot {
  background: #22c55e;
}

/* ============================================================================
   Responsive
   ============================================================================ */

@media (max-width: 768px) {
  .header-nav {
    display: none;
  }

  .hero-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .hero-banner {
    height: 160px;
  }

  .cart-sidebar {
    width: 100%;
  }

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