/* =========================================
   Pizzeria Popular – PoC Styles
   Design based on reference mockup
   ========================================= */

:root {
  /* Brand colors */
  --color-primary: #E31837;
  --color-primary-dark: #c01530;
  --color-dark: #1a1a2e;
  --color-dark-alt: #16213e;
  --color-white: #ffffff;
  --color-gray-50: #f8f9fa;
  --color-gray-100: #f1f3f5;
  --color-gray-200: #e9ecef;
  --color-gray-300: #dee2e6;
  --color-gray-400: #ced4da;
  --color-gray-500: #adb5bd;
  --color-gray-600: #868e96;
  --color-gray-700: #495057;
  --color-gray-800: #343a40;
  --color-gray-900: #212529;
  --color-text: #212529;
  --color-text-muted: #6c757d;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Border radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);

  /* Layout */
  --header-height: 56px;
  --footer-height: 140px;
  --max-width: 480px;
}

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

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

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-gray-100);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input {
  font-family: inherit;
  font-size: inherit;
  border: none;
  outline: none;
}

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

ul, ol {
  list-style: none;
}

/* App container */
.app {
  max-width: var(--max-width);
  margin: 0 auto;
  background: var(--color-white);
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* =========================================
   Top Bar (Language + Mesa)
   ========================================= */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-white);
}

.lang-switch {
  display: flex;
  background: var(--color-gray-100);
  border-radius: var(--radius-full);
  padding: 2px;
}

.lang-switch button {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-gray-600);
  border-radius: var(--radius-full);
  transition: all 0.2s;
}

.lang-switch button.active {
  background: var(--color-white);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}

.mesa-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 1px;
}

/* =========================================
   Header with Logo
   ========================================= */
.header {
  background: var(--color-dark);
  padding: var(--space-lg) var(--space-md);
  text-align: center;
}

.header-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.header-logo-text {
  color: var(--color-white);
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.header-logo-sub {
  color: var(--color-white);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 4px;
  text-transform: uppercase;
}

/* =========================================
   Hero Section
   ========================================= */
.hero {
  padding: var(--space-xl) var(--space-md) var(--space-lg);
  background: var(--color-white);
}

.hero-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}

.hero-title em {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--color-primary);
}

.hero-subtitle {
  font-size: 15px;
  color: var(--color-text-muted);
  max-width: 280px;
}

/* =========================================
   Search Bar
   ========================================= */
.search-container {
  padding: var(--space-md);
  background: var(--color-white);
}

.search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--color-gray-100);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-gray-200);
}

.search-bar svg {
  width: 20px;
  height: 20px;
  color: var(--color-gray-500);
  flex-shrink: 0;
}

.search-bar input {
  flex: 1;
  background: transparent;
  font-size: 15px;
  color: var(--color-text);
}

.search-bar input::placeholder {
  color: var(--color-gray-500);
}

/* =========================================
   Categories
   ========================================= */
.categories {
  padding: var(--space-md);
  background: var(--color-white);
  border-bottom: 1px solid var(--color-gray-200);
}

.categories-scroll {
  display: flex;
  gap: var(--space-lg);
  overflow-x: auto;
  padding-bottom: var(--space-xs);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.categories-scroll::-webkit-scrollbar {
  display: none;
}

.category-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.2s;
}

.category-item:active {
  transform: scale(0.95);
}

.category-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-gray-100);
  transition: all 0.2s;
}

.category-item.active .category-icon {
  background: var(--color-primary);
}

.category-icon svg {
  width: 24px;
  height: 24px;
  color: var(--color-gray-700);
}

.category-item.active .category-icon svg {
  color: var(--color-white);
}

.category-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-gray-600);
}

.category-item.active .category-label {
  color: var(--color-primary);
}

/* =========================================
   Section Header
   ========================================= */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-lg) var(--space-md) var(--space-md);
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
}

.section-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* =========================================
   Product Cards
   ========================================= */
.products-list {
  flex: 1;
  padding: 0 var(--space-md);
  padding-bottom: var(--footer-height);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  overflow-y: auto;
}

.product-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.product-image-container {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  border-radius: var(--radius-lg);
  margin: var(--space-sm);
}

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

.product-price-badge {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  background: var(--color-white);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  box-shadow: var(--shadow-md);
}

.product-info {
  padding: var(--space-sm) var(--space-md) var(--space-md);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-md);
}

.product-details {
  flex: 1;
}

.product-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 4px;
}

.product-description {
  font-size: 14px;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.product-add-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  box-shadow: var(--shadow-md);
}

.product-add-btn:active {
  transform: scale(0.9);
  background: var(--color-primary-dark);
}

.product-add-btn svg {
  width: 24px;
  height: 24px;
  color: var(--color-white);
}

/* =========================================
   Footer (Fixed)
   ========================================= */
.footer {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  background: var(--color-white);
  padding: var(--space-md);
  padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom, 0));
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  z-index: 100;
}

.powered-by-footer {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--color-gray-400);
  text-decoration: none;
  white-space: nowrap;
  background: var(--color-white);
  padding: 2px 10px;
  border-radius: var(--radius-full);
}

.powered-by-footer strong {
  color: var(--color-gray-500);
  font-weight: 600;
}

.powered-by-footer:hover {
  color: var(--color-primary);
}

.powered-by-footer:hover strong {
  color: var(--color-primary);
}

.call-waiter-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-gray-800);
  color: var(--color-white);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.2s;
}

.call-waiter-btn:active {
  background: var(--color-gray-900);
}

.call-waiter-btn svg {
  width: 16px;
  height: 16px;
}

.review-order-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--color-primary);
  color: var(--color-white);
  border-radius: var(--radius-full);
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.2s;
}

.review-order-btn:active {
  background: var(--color-primary-dark);
}

.review-order-btn:disabled {
  background: var(--color-gray-300);
  cursor: not-allowed;
}

.review-order-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.order-count {
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

/* =========================================
   Cart Modal
   ========================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.cart-modal {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: var(--max-width);
  max-height: 85vh;
  background: var(--color-white);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  z-index: 201;
  transition: transform 0.3s ease-out;
  display: flex;
  flex-direction: column;
}

.cart-modal.open {
  transform: translateX(-50%) translateY(0);
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-gray-200);
}

.cart-title {
  font-size: 20px;
  font-weight: 700;
}

.cart-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-close-btn svg {
  width: 20px;
  height: 20px;
  color: var(--color-gray-700);
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
}

.cart-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-gray-100);
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item-image {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
}

.cart-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.cart-item-name {
  font-size: 16px;
  font-weight: 600;
}

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

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: auto;
}

.qty-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
}

.qty-btn:active {
  background: var(--color-gray-200);
}

.qty-value {
  width: 32px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
}

.cart-item-total {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  align-self: center;
}

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

.cart-footer {
  padding: var(--space-md) var(--space-lg);
  padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom, 0));
  border-top: 1px solid var(--color-gray-200);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.cart-totals {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--color-text-muted);
}

.cart-total-row.total {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-gray-200);
}

.cart-actions {
  display: flex;
  gap: var(--space-sm);
}

.cart-actions button {
  flex: 1;
  padding: var(--space-md);
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-secondary {
  background: var(--color-gray-100);
  color: var(--color-text);
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-white);
}

.btn-primary:active {
  background: var(--color-primary-dark);
}

/* =========================================
   Success Modal
   ========================================= */
.success-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: calc(100% - 48px);
  max-width: 360px;
  background: var(--color-white);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-lg);
  text-align: center;
  z-index: 202;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.success-modal.open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.success-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-lg);
  background: linear-gradient(135deg, #10b981, #34d399);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-icon svg {
  width: 40px;
  height: 40px;
  color: white;
}

.success-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.success-message {
  font-size: 15px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
}

/* =========================================
   Admin Panel Styles
   ========================================= */
.admin-app {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-lg);
  min-height: 100vh;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.admin-logo {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.admin-logo-icon {
  width: 48px;
  height: 48px;
  background: var(--color-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-logo-icon svg {
  width: 28px;
  height: 28px;
  color: white;
}

.admin-logo-text {
  font-size: 24px;
  font-weight: 700;
}

.admin-actions {
  display: flex;
  gap: var(--space-sm);
}

.admin-btn {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.admin-btn--primary {
  background: var(--color-primary);
  color: white;
}

.admin-btn--secondary {
  background: var(--color-gray-200);
  color: var(--color-text);
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: var(--space-lg);
}

.admin-section {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}

.admin-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.admin-section-title {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  background: var(--color-primary);
  color: white;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-full);
}

.order-card {
  background: var(--color-gray-50);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  border-left: 4px solid var(--color-primary);
}

.order-card.seen {
  border-left-color: var(--color-gray-300);
  opacity: 0.7;
}

.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-sm);
}

.order-table {
  font-size: 16px;
  font-weight: 700;
}

.order-time {
  font-size: 12px;
  color: var(--color-text-muted);
}

.order-status {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

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

.order-status.seen {
  background: var(--color-gray-200);
  color: var(--color-gray-600);
}

.order-items-list {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
}

.order-total {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-primary);
}

.order-actions {
  margin-top: var(--space-sm);
}

.order-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  background: var(--color-gray-200);
  color: var(--color-text);
}

.order-btn:hover {
  background: var(--color-gray-300);
}

.empty-state {
  text-align: center;
  padding: var(--space-xl);
  color: var(--color-text-muted);
}

/* =========================================
   Index/Landing Page
   ========================================= */
.landing {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--space-xl);
  text-align: center;
}

.landing-logo {
  width: 120px;
  height: 120px;
  background: var(--color-dark);
  border-radius: var(--radius-xl);
  margin: 0 auto var(--space-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.landing-logo-text {
  color: white;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
}

.landing-logo-sub {
  color: white;
  font-size: 8px;
  letter-spacing: 2px;
}

.landing-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.landing-subtitle {
  font-size: 16px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-xl);
}

.mesa-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.mesa-link {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-white);
  border: 2px solid var(--color-gray-200);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  transition: all 0.2s;
}

.mesa-link:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-2px);
}

.landing-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.landing-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--color-white);
  border-radius: var(--radius-md);
  font-weight: 600;
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.landing-link:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.landing-link.primary {
  background: var(--color-primary);
  color: white;
}

/* =========================================
   Utilities
   ========================================= */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =========================================
   Responsive
   ========================================= */
@media (min-width: 768px) {
  .admin-app {
    padding: var(--space-xl);
  }
}

@media (max-width: 480px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
  
  .mesa-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
