/* assets/css/style.css - Al Madina Mart & Cafe Strict Design System */
:root {
  --primary-red: #EF3030;
  --primary-red-hover: #D82525;
  --primary-red-light: #FFF1F1;
  --secondary-yellow: #FFE600;
  --secondary-yellow-hover: #F0D800;
  --secondary-yellow-light: #FFFEEA;
  --white: #FFFFFF;
  --text-dark: #171717;
  --text-muted: #666666;
  --bg-light: #F8F8F8;
  --border-light: #EEEEEE;
  --border-subtle: #E2E2E2;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  overflow-x: hidden !important;
  max-width: 100vw;
  width: 100%;
}

img {
  max-width: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-light);
  color: var(--text-dark);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

button, input, select, textarea {
  font-family: inherit;
}

/* Layout container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Sticky Header */
.announcement-bar {
  background-color: var(--primary-red);
  color: var(--white);
  padding: 6px 0;
  font-size: 12px;
  font-weight: 500;
  width: 100%;
  overflow-x: hidden;
}

.announcement-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}

.announcement-left {
  flex: 1 1 auto;
  min-width: 0;
}

.announcement-right {
  flex-shrink: 0;
  display: flex;
  gap: 14px;
  align-items: center;
}

@media (max-width: 768px) {
  .announcement-flex {
    flex-direction: column;
    text-align: center;
    gap: 6px;
  }
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--white);
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  gap: 16px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brand-logo-img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--primary-red);
  object-fit: contain;
  background: #fff;
}

.brand-name {
  font-size: 18px;
  font-weight: 900;
  color: var(--primary-red);
  text-transform: uppercase;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.brand-tag {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Mode Switch: Cafe & Food / Mart & Grocery */
.mode-switch {
  display: inline-flex;
  background-color: #F0F0F0;
  border-radius: 30px;
  padding: 3px;
  border: 1px solid var(--border-light);
}

.mode-btn {
  padding: 6px 14px;
  border-radius: 24px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dark);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mode-btn.active {
  background-color: var(--primary-red);
  color: var(--white);
  box-shadow: 0 2px 6px rgba(239, 48, 48, 0.25);
}

.mode-btn.mart-active {
  background-color: #15803d;
  color: var(--white);
  box-shadow: 0 2px 6px rgba(21, 128, 61, 0.25);
}

/* Header search & actions */
.header-search {
  flex: 1;
  max-width: 380px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 8px 16px 8px 36px;
  background-color: #F2F2F2;
  border: 1px solid transparent;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-dark);
  outline: none;
  transition: all 0.2s;
}

.search-input:focus {
  background-color: #FFF;
  border-color: var(--primary-red);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 9px;
  width: 16px;
  height: 16px;
  fill: #888;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-whatsapp-order {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #25D366;
  color: #FFF;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}

.btn-cart-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--primary-red);
  color: #FFF;
  border: none;
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  position: relative;
}

.cart-badge {
  background-color: var(--secondary-yellow);
  color: var(--text-dark);
  font-size: 11px;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 10px;
}

/* Navigation bar */
.nav-bar {
  border-top: 1px solid var(--border-light);
  overflow-x: auto;
  white-space: nowrap;
}

.nav-list {
  display: flex;
  list-style: none;
  gap: 6px;
  padding: 6px 0;
}

.nav-link {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--text-dark);
  transition: all 0.15s;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary-red);
  background-color: var(--primary-red-light);
}

/* Hero Section */
.hero-section {
  background-color: #FFFFFF;
  border-bottom: 1px solid var(--border-light);
  padding: 36px 0;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: center;
}

@media (min-width: 768px) {
  .hero-grid {
    grid-template-columns: 1.2fr 0.8fr;
  }
}

.hero-badge {
  display: inline-block;
  background-color: var(--secondary-yellow);
  color: var(--text-dark);
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.hero-title {
  font-size: 32px;
  font-weight: 900;
  line-height: 1.15;
  color: var(--text-dark);
  margin-bottom: 12px;
}

.hero-title span {
  color: var(--primary-red);
}

.hero-subtext {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-primary {
  background-color: var(--primary-red);
  color: var(--white);
  border: none;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.15s;
}

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

.btn-yellow {
  background-color: var(--secondary-yellow);
  color: var(--text-dark);
  border: 1px solid #E8D000;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-yellow:hover {
  background-color: var(--secondary-yellow-hover);
}

.btn-secondary {
  background-color: #FFFFFF;
  color: var(--text-dark);
  border: 1px solid var(--border-subtle);
  padding: 12px 20px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 700;
}

/* Section styling */
.section {
  padding: 36px 0;
}

.section-header {
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.section-title {
  font-size: 22px;
  font-weight: 900;
  color: var(--text-dark);
}

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

/* Category Pills Bar */
.category-pills {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 16px 14px 4px;
  margin-bottom: 24px;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #EF3030 #F1F5F9;
}

.category-pills::-webkit-scrollbar {
  height: 6px;
}

.category-pills::-webkit-scrollbar-track {
  background: #F1F5F9;
  border-radius: 6px;
}

.category-pills::-webkit-scrollbar-thumb {
  background: #EF3030;
  border-radius: 6px;
}

.cat-pill {
  flex-shrink: 0;
  white-space: nowrap;
  background-color: var(--white);
  border: 1px solid var(--border-light);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.15s ease;
}

.cat-pill:hover {
  border-color: var(--primary-red);
  color: var(--primary-red);
}

.cat-pill.active {
  background-color: var(--primary-red);
  color: var(--white);
  border-color: var(--primary-red);
}

/* Product Cards Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.product-card {
  background-color: var(--white);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(239, 48, 48, 0.12);
  border-color: #F8B4B4;
}

.product-card-img-wrap {
  position: relative;
  width: 100%;
  height: 165px;
  border-radius: 10px;
  overflow: hidden;
  background-color: #F8F8F8;
  margin-bottom: 12px;
}

.product-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
  display: block;
}

.product-card:hover .product-card-img {
  transform: scale(1.06);
}

.card-img-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.card-img-badge.deal {
  background-color: var(--secondary-yellow);
  color: var(--text-dark);
}

.card-img-badge.category {
  background-color: rgba(255, 255, 255, 0.92);
  color: var(--primary-red);
}

.card-top {
  margin-bottom: 12px;
}

.card-badge-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.card-cat {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary-red);
  background-color: var(--primary-red-light);
  padding: 2px 6px;
  border-radius: 4px;
}

.card-stock {
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap !important;
}
.card-stock.in-stock { color: #15803d; }
.card-stock.out-of-stock { color: #dc2626; }

.product-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.product-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 8px;
  overflow-wrap: break-word;
  word-break: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #F5F5F5;
  padding-top: 12px;
  margin-top: auto;
  gap: 8px;
}

.price-box {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-width: 0;
}

.price-label {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap !important;
}

.price-val {
  font-size: 16px;
  font-weight: 900;
  color: var(--primary-red);
  white-space: nowrap !important;
}

/* Hero Section Image & Overlay */
.hero-image-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hero-image-wrap {
  position: relative;
  width: 100%;
  height: 290px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(239, 48, 48, 0.12);
  border: 3px solid #FFF;
  background-color: #F8F8F8;
}

.hero-main-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.hero-image-wrap:hover .hero-main-img {
  transform: scale(1.04);
}

.hero-image-overlay-badge {
  position: absolute;
  bottom: 14px;
  left: 14px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
  padding: 8px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  border: 1px solid rgba(239, 48, 48, 0.18);
}

.hero-contact-strip {
  background: #FFF;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-card-add {
  background-color: var(--primary-red-light);
  color: var(--primary-red);
  border: 1px solid #FED7D7;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-card-add:hover {
  background-color: var(--primary-red);
  color: var(--white);
}

/* Empty State (for Mart Shelf & Unset Sections) */
.empty-shelf {
  background-color: var(--white);
  border: 1px dashed var(--border-subtle);
  border-radius: 12px;
  padding: 48px 20px;
  text-align: center;
}

.empty-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 6px;
}

.empty-sub {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background-color: var(--white);
  border-radius: 16px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  padding: 24px;
  position: relative;
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: #EEE;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
}

/* Cart Drawer */
.cart-drawer-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0,0,0,0.4);
  display: none;
  justify-content: flex-end;
  z-index: 1000;
}

.cart-drawer-overlay.open {
  display: flex;
}

.cart-drawer {
  background-color: var(--white);
  width: 100%;
  max-width: 420px;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0,0,0,0.1);
}

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

.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.cart-footer {
  padding: 16px;
  border-top: 1px solid var(--border-light);
  background-color: #FAFAFA;
}

.cart-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 900;
  color: var(--primary-red);
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
  margin-top: 8px;
}

/* Light Footer ONLY */
.site-footer {
  background-color: #FFFFFF;
  border-top: 1px solid var(--border-light);
  padding: 40px 0 20px 0;
  color: var(--text-dark);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  margin-bottom: 30px;
}

.footer-heading {
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 12px;
  color: var(--primary-red);
}

.footer-list {
  list-style: none;
  font-size: 13px;
  color: var(--text-muted);
}

.footer-list li {
  margin-bottom: 8px;
}

.footer-bottom {
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* Form inputs */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
  text-transform: uppercase;
  color: var(--text-dark);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}

.form-control:focus {
  border-color: var(--primary-red);
}

/* Badges */
.badge-mart {
  background-color: #15803d;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 3px;
}

/* ========================================================
   RESPONSIVE DESIGN & MOBILE OPTIMIZATIONS
   ======================================================== */

/* Mobile Menu Toggle Button */
.btn-mobile-menu {
  display: none;
  background: var(--bg-light);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  color: var(--text-dark);
  cursor: pointer;
}

.mobile-sub-header {
  display: none;
}

.mobile-only-link {
  display: none;
}

.track-form {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.success-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}

/* Tablet & Mobile Breakpoint (<= 768px) */
@media (max-width: 768px) {
  .container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 14px !important;
  }

  /* Announcement Bar */
  .announcement-bar {
    padding: 6px 0;
    font-size: 11px;
  }
  .announcement-flex {
    flex-direction: column;
    text-align: center;
    gap: 4px;
  }
  .announcement-right {
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
  }

  /* Header */
  .header-main {
    padding: 8px 0;
    gap: 8px;
  }
  .brand-logo-img {
    width: 40px;
    height: 40px;
  }
  .brand-name {
    font-size: 16px;
  }
  .brand-tag {
    font-size: 10px;
  }

  /* Hide desktop search, desktop mode switch, desktop whatsapp button */
  .desktop-search,
  .desktop-mode-switch,
  .desktop-wa {
    display: none !important;
  }

  /* Show mobile button & mobile sub-header */
  .btn-mobile-menu {
    display: inline-flex;
  }
  .mobile-sub-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 8px;
  }
  .mobile-mode-switch {
    width: 100%;
    display: flex;
    justify-content: center;
  }
  .mobile-mode-switch .mode-btn {
    flex: 1;
    text-align: center;
    justify-content: center;
    padding: 8px 10px;
    font-size: 12px;
  }
  .mobile-search {
    width: 100%;
    max-width: 100%;
  }

  /* Mobile Navigation Menu */
  .nav-bar {
    display: none;
    background: #FFFFFF;
    border-top: 1px solid var(--border-light);
    border-bottom: 2px solid var(--primary-red);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  }
  .nav-bar.mobile-open {
    display: block;
  }
  .nav-list {
    flex-direction: column;
    padding: 8px 0;
    gap: 2px;
    white-space: normal;
  }
  .nav-link {
    display: block;
    padding: 10px 14px;
    font-size: 13px;
    border-radius: 6px;
  }
  .mobile-only-link {
    display: block;
    border-top: 1px dashed #EEE;
    margin-top: 4px;
    padding-top: 4px;
  }

  /* Hero Section */
  .hero-section {
    padding: 20px 0;
  }
  .hero-title {
    font-size: 24px !important;
    line-height: 1.25;
    word-break: break-word;
  }
  .hero-subtext {
    font-size: 13px;
    margin-bottom: 14px;
  }
  .hero-ctas {
    flex-direction: column;
    gap: 8px;
  }
  .hero-ctas .btn-primary,
  .hero-ctas .btn-yellow,
  .hero-ctas .btn-secondary {
    width: 100%;
    justify-content: center;
    padding: 11px 16px;
    font-size: 14px;
  }
  .hero-image-wrap {
    height: 200px;
  }

  /* Products Grid: 1-column on mobile phones to prevent horizontal overflow */
  .products-grid {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }
  .product-card {
    padding: 12px;
    width: 100%;
  }
  .product-card-img-wrap {
    height: 170px;
  }

  /* Category pills */
  .category-pills {
    padding-bottom: 8px;
    margin-bottom: 16px;
  }

  /* Modals: strictly constrained to mobile width & centered */
  .modal-overlay {
    padding: 12px !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .modal-box {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 16px !important;
    border-radius: 14px !important;
    max-height: 88vh;
  }

  /* Cart Drawer: full width on mobile */
  .cart-drawer {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Checkout page */
  .checkout-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .delivery-type-options {
    flex-direction: column !important;
    gap: 8px !important;
  }

  /* Tracking page search form */
  .track-form {
    flex-direction: column !important;
  }
  .track-form input,
  .track-form button {
    width: 100% !important;
  }

  /* Order confirmation actions */
  .success-actions-grid {
    grid-template-columns: 1fr !important;
  }

  /* Reviews page */
  .review-form-cols {
    grid-template-columns: 1fr !important;
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}
