/* ==========================================================================
   SIPLY CAFE - BESPOKE SPECIALTY COFFEE MENU
   Refined quiet luxury styling, 100% mobile & desktop responsive
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Readex+Pro:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Brand Core Palette */
  --siply-green: #163326;
  --siply-green-hover: #0f241a;
  --siply-green-light: #234b39;
  --siply-terracotta: #b9723e;
  --siply-terracotta-soft: rgba(185, 114, 62, 0.1);

  /* Canvas & Surfaces */
  --bg-main: #f8f5ee;
  --surface-card: #ffffff;
  --surface-subtle: #f2eee5;
  --border-subtle: rgba(22, 51, 38, 0.08);
  --border-strong: rgba(22, 51, 38, 0.16);

  /* Typography */
  --text-primary: #19241e;
  --text-secondary: #57655d;
  --text-tertiary: #8b9991;

  /* Shadows */
  --shadow-card: 0 1px 3px rgba(22, 51, 38, 0.04), 0 4px 14px rgba(22, 51, 38, 0.03);
  --shadow-hover: 0 6px 20px rgba(22, 51, 38, 0.09);

  /* Fonts */
  --font-ar: 'Readex Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-en: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --transition-smooth: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark Velvet Theme */
[data-theme="dark"] {
  --bg-main: #0f1612;
  --surface-card: #15201a;
  --surface-subtle: #1c2b23;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text-primary: #f5efe6;
  --text-secondary: #9eb0a5;
  --text-tertiary: #6b7c72;
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.5);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  width: 100%;
}

body {
  font-family: var(--font-ar);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  direction: rtl;
  text-align: right;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
  box-sizing: border-box;
}

/* Top Sticky Navigation */
.top-nav {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 100;
  background: rgba(248, 245, 238, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color 0.3s ease;
}

[data-theme="dark"] .top-nav {
  background: rgba(15, 22, 18, 0.94);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand-logo-small {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
}

.brand-title {
  font-family: var(--font-en);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--siply-green);
  line-height: 1.1;
}

[data-theme="dark"] .brand-title {
  color: #72d8a6;
}

.brand-sub {
  font-family: var(--font-en);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--siply-terracotta);
  text-transform: uppercase;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-card);
  color: var(--text-primary);
  font-family: var(--font-ar);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.action-btn.instagram {
  color: #e1306c;
  border-color: rgba(225, 48, 108, 0.2);
  background: rgba(225, 48, 108, 0.05);
}

.action-btn.instagram:hover {
  background: rgba(225, 48, 108, 0.12);
}

.icon-only-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--surface-card);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  transition: var(--transition-smooth);
}

.icon-only-btn:hover {
  background: var(--surface-subtle);
}

/* Hero Section */
.hero {
  padding: 30px 0 20px;
  text-align: center;
}

.hero-logo-frame {
  width: 96px;
  height: 96px;
  margin: 0 auto 14px;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(22, 51, 38, 0.08);
  border: 3px solid var(--surface-card);
}

.hero-logo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-heading {
  font-family: var(--font-en);
  font-size: 1.95rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--siply-green);
  margin-bottom: 2px;
}

[data-theme="dark"] .hero-heading {
  color: #6ed3a2;
}

.hero-motto {
  font-family: var(--font-en);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--siply-terracotta);
  text-transform: uppercase;
  margin-bottom: 16px;
}

/* Meta Pills */
.meta-pills {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.meta-pill.highlight {
  color: var(--siply-green);
  background: rgba(22, 51, 38, 0.06);
  border-color: rgba(22, 51, 38, 0.16);
  font-weight: 600;
}

[data-theme="dark"] .meta-pill.highlight {
  color: #6ed3a2;
  background: rgba(110, 211, 162, 0.1);
  border-color: rgba(110, 211, 162, 0.2);
}

.meta-pill a {
  color: inherit;
  text-decoration: none;
}

/* Search Bar */
.search-container {
  max-width: 520px;
  margin: 0 auto;
  position: relative;
  width: 100%;
}

.search-field {
  width: 100%;
  padding: 12px 42px 12px 38px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-card);
  font-family: var(--font-ar);
  font-size: 0.92rem;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition-smooth);
}

.search-field:focus {
  border-color: var(--siply-green);
  box-shadow: 0 0 0 3px rgba(22, 51, 38, 0.08);
}

[data-theme="dark"] .search-field:focus {
  border-color: #6ed3a2;
  box-shadow: 0 0 0 3px rgba(110, 211, 162, 0.15);
}

.search-icon-svg {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
  font-size: 0.9rem;
}

.search-clear-btn {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  display: none;
}

.search-clear-btn.active {
  display: block;
}

/* Category Filter Bar */
.category-bar-wrapper {
  position: sticky;
  top: 61px;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 90;
  background: rgba(248, 245, 238, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color 0.3s ease;
  margin-bottom: 24px;
}

[data-theme="dark"] .category-bar-wrapper {
  background: rgba(15, 22, 18, 0.96);
}

.category-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  padding: 2px 0;
}

.category-bar::-webkit-scrollbar {
  display: none;
}

.cat-tab {
  flex-shrink: 0;
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-card);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.cat-tab.active {
  background: var(--siply-green);
  border-color: var(--siply-green);
  color: #ffffff;
  font-weight: 600;
}

[data-theme="dark"] .cat-tab.active {
  background: #254a37;
  border-color: #3b7457;
  color: #ffffff;
}

/* Category Groups */
.menu-group {
  margin-bottom: 40px;
  scroll-margin-top: 130px;
}

.group-header {
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.group-title-ar {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--siply-green);
}

[data-theme="dark"] .group-title-ar {
  color: #6ed3a2;
}

.group-title-en {
  font-family: var(--font-en);
  font-size: 0.8rem;
  color: var(--siply-terracotta);
  font-weight: 600;
  margin-right: 8px;
}

.group-count {
  font-size: 0.78rem;
  color: var(--text-tertiary);
}

/* Items Grid */
.items-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 680px) {
  .items-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
}

@media (min-width: 980px) {
  .items-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

/* Menu Item Card */
.menu-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  transition: var(--transition-smooth);
}

.menu-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-hover);
}

.card-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.item-text {
  flex: 1;
}

.item-name-ar {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 2px;
}

.item-name-en {
  font-family: var(--font-en);
  font-size: 0.78rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.item-pricing {
  flex-shrink: 0;
  text-align: left;
}

.price-val {
  font-family: var(--font-en);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--siply-green);
  letter-spacing: -0.5px;
}

[data-theme="dark"] .price-val {
  color: #6ed3a2;
}

.price-unit {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: 2px;
}

/* Card Action Button */
.card-action {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-top: 10px;
  border-top: 1px solid var(--surface-subtle);
}

.order-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-family: var(--font-ar);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.order-btn:hover {
  background: var(--siply-green);
  border-color: var(--siply-green);
  color: #ffffff;
}

[data-theme="dark"] .order-btn:hover {
  background: #2b5640;
  border-color: #2b5640;
}

.order-btn.in-order {
  background: var(--siply-terracotta);
  border-color: var(--siply-terracotta);
  color: #ffffff;
  font-weight: 600;
}

/* Empty State */
.no-items-found {
  display: none;
  text-align: center;
  padding: 40px 16px;
  background: var(--surface-card);
  border-radius: 16px;
  border: 1px dashed var(--border-strong);
  margin: 20px 0;
}

.no-items-found h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.no-items-found p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Bottom Floating Order Pill */
.floating-order-pill {
  position: fixed;
  bottom: 20px;
  left: 16px;
  right: 16px;
  margin: 0 auto;
  max-width: 440px;
  width: calc(100% - 32px);
  z-index: 999;
  background: var(--siply-green);
  color: #ffffff;
  border-radius: 999px;
  padding: 12px 20px;
  box-shadow: 0 10px 30px rgba(16, 39, 29, 0.45);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transform: translateY(150%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.floating-order-pill.visible {
  transform: translateY(0);
}

.pill-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill-count {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--siply-terracotta);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 0.85rem;
}

.pill-label {
  font-size: 0.9rem;
  font-weight: 600;
}

.pill-total {
  font-family: var(--font-en);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

/* ==========================================================================
   ORDER MODAL SHEET (PERFECT MOBILE NATIVE SHEET)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(15, 22, 18, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  box-sizing: border-box;
}

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

.modal-sheet {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  height: auto;
  max-height: 80dvh;
  max-height: 80vh;
  background: var(--surface-card);
  border-radius: 24px 24px 0 0;
  padding: 16px 18px 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1);
  overflow: hidden;
  box-shadow: 0 -8px 36px rgba(0, 0, 0, 0.25);
}

@media (min-width: 580px) {
  .modal-overlay {
    align-items: center;
    justify-content: center;
    padding: 20px;
  }
  .modal-sheet {
    border-radius: 24px;
    max-height: 85vh;
    padding: 20px 22px 0;
    transform: scale(0.96) translateY(20px);
  }
  .modal-overlay.open .modal-sheet {
    transform: scale(1) translateY(0);
  }
}

.modal-overlay.open .modal-sheet {
  transform: translateY(0);
}

@media (min-width: 580px) {
  .modal-overlay.open .modal-sheet {
    transform: scale(1) translateY(0);
  }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 10px;
  width: 100%;
  flex-shrink: 0;
}

.sheet-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--siply-green);
}

[data-theme="dark"] .sheet-title {
  color: #6ed3a2;
}

.sheet-close {
  background: var(--surface-subtle);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
}

.sheet-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0; /* Crucial for scroll containment in flex column */
  padding: 4px 0 12px;
  width: 100%;
}

.order-items-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.order-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--surface-subtle);
  border-radius: 12px;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}

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

.order-row-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.3;
}

.order-row-calc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.order-row-calc span {
  font-family: var(--font-en);
  font-weight: 600;
}

.qty-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-card);
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.qty-control {
  background: none;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: bold;
}

.qty-digit {
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 0.92rem;
  min-width: 16px;
  text-align: center;
}

/* Modal Footer & Inputs */
.sheet-foot {
  flex-shrink: 0; /* Guaranteed to never be pushed out or squished */
  padding-top: 10px;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
  border-top: 1px solid var(--border-subtle);
  width: 100%;
  background: var(--surface-card);
  box-sizing: border-box;
}

.total-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 8px;
  font-size: 1.05rem;
  font-weight: 700;
}

.total-digit {
  font-family: var(--font-en);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--siply-green);
}

[data-theme="dark"] .total-digit {
  color: #6ed3a2;
}

.customer-note-box {
  width: 100%;
  margin-bottom: 8px;
  box-sizing: border-box;
}

.sheet-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-subtle);
  font-family: var(--font-ar);
  font-size: 0.84rem;
  color: var(--text-primary);
  outline: none;
  box-sizing: border-box;
  transition: var(--transition-smooth);
}

.sheet-input:focus {
  border-color: var(--siply-green);
  background: var(--surface-card);
}

[data-theme="dark"] .sheet-input:focus {
  border-color: #6ed3a2;
}

.sheet-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.btn-whatsapp-send {
  width: 100%;
  padding: 12px 18px;
  border-radius: 12px;
  border: none;
  background: #25D366;
  color: #ffffff;
  font-family: var(--font-ar);
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
  box-sizing: border-box;
  transition: var(--transition-smooth);
}

.btn-whatsapp-send:hover {
  background: #20bd5a;
}

.btn-reset-order {
  width: 100%;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-ar);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box;
  transition: var(--transition-smooth);
}

.btn-reset-order:hover {
  color: #d9434e;
  border-color: rgba(217, 67, 78, 0.3);
}

/* Quiet Luxury Footer */
.footer {
  margin-top: 50px;
  padding: 36px 0 90px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  width: 100%;
}

.footer-brand {
  margin-bottom: 10px;
}

.footer-brand-title {
  font-family: var(--font-en);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--siply-green);
  letter-spacing: -0.5px;
}

[data-theme="dark"] .footer-brand-title {
  color: #6ed3a2;
}

.footer-tag {
  font-family: var(--font-en);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--siply-terracotta);
  text-transform: uppercase;
  margin-bottom: 14px;
}

.footer-social-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #e1306c;
  font-weight: 600;
  text-decoration: none;
  font-size: 0.88rem;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(225, 48, 108, 0.06);
  border: 1px solid rgba(225, 48, 108, 0.15);
  margin-bottom: 16px;
}

.footer-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 18px;
}

.footer-copyright {
  font-size: 0.76rem;
  color: var(--text-tertiary);
}

/* Toast Message */
.toast-msg {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--siply-green);
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 500;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.toast-msg.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
