/*
Theme Name: Karam Haratna
Theme URI: https://karam-haratna.com
Author: Karam Haratna Dev
Description: كرم حارتنا — موقع مطعم كويتي مخصص لعرض قائمة الطعام والطلب عبر واتساب
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GPL v2 or later
Text Domain: kilo-meshakil
*/

/* ============================================================
   كرم حارتنا — styles
   ============================================================ */

:root {
  --red: #c8102e;
  --red-dark: #a30c25;
  --cream: #f5e7c8;
  --parchment: #e8d199;
  --bg: #f4f4f4;
  --card: #ffffff;
  --ink: #1f1f1f;
  --muted: #6b6b6b;
  --border: #e5e5e5;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --whatsapp: #25d366;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: 'Cairo', 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

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

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input {
  font: inherit;
}

/* ----------------------------------------------------------------
   Header
   ---------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 16px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.cart-toggle {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: #f7f7f7;
  transition: background 0.15s ease;
  justify-self: start;
}

.cart-toggle:hover {
  background: #eee;
}

.cart-toggle svg {
  width: 22px;
  height: 22px;
  fill: var(--ink);
}

.cart-toggle.bump {
  animation: bump 0.35s ease;
}

@keyframes bump {
  0% { transform: scale(1); }
  50% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.cart-count {
  position: absolute;
  top: -2px;
  inset-inline-end: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
}

.cart-count.is-visible {
  display: flex;
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #1c1c1c;
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 15px;
  line-height: 1.1;
  letter-spacing: 0.5px;
  box-shadow: inset 0 0 0 2px #d4af37;
}

.brand-logo .brand-ar {
  color: var(--red);
  margin-inline-end: 6px;
  font-size: 18px;
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
}

.pill-btn {
  background: var(--red);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  transition: background 0.15s ease;
}

.pill-btn:hover {
  background: var(--red-dark);
}

.menu-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: #f7f7f7;
}

.menu-btn:hover {
  background: #eee;
}

.menu-btn svg {
  width: 20px;
  height: 20px;
  fill: var(--ink);
}

/* ----------------------------------------------------------------
    Hero Slider
    ---------------------------------------------------------------- */

.slider {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 1;
  background: #1c1c1c;
}

.slider-track {
  display: flex;
  transition: transform 0.5s ease;
  height: 100%;
}

.slide {
  flex: 0 0 100%;
  position: relative;
  height: 100%;
}

.slide-bg {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.slider-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  font-size: 22px;
  display: inline-grid;
  place-items: center;
  z-index: 10;
  box-shadow: var(--shadow);
  transition: background 0.15s ease;
  line-height: 1;
}

.slider-btn:hover {
  background: #fff;
}

.slider-prev {
  inset-inline-start: 12px;
}

.slider-next {
  inset-inline-end: 12px;
}

.slider-dots {
  position: absolute;
  bottom: 10px;
  inset-inline: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  z-index: 10;
}

.slider-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transition: background 0.2s ease, transform 0.2s ease;
}

.slider-dot:hover {
  background: rgba(255, 255, 255, 0.8);
}

.slider-dot.is-active {
  background: var(--red);
  transform: scale(1.2);
}

/* ----------------------------------------------------------------
   Search
   ---------------------------------------------------------------- */

.search-wrap {
  max-width: 1200px;
  margin: 16px auto 0;
  padding: 0 16px;
}

.search {
  position: relative;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.search input {
  width: 100%;
  padding: 14px 48px 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  outline: none;
  text-align: right;
}

.search input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.12);
}

.search-icon {
  position: absolute;
  inset-inline-start: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  fill: var(--muted);
  pointer-events: none;
}

/* ----------------------------------------------------------------
   Categories
   ---------------------------------------------------------------- */

.categories-wrap {
  max-width: 1200px;
  margin: 16px auto 0;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}

.categories {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  padding: 8px 4px 12px;
  scrollbar-width: thin;
}

.categories::-webkit-scrollbar {
  height: 6px;
}

.categories::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 3px;
}

.cat {
  flex: 0 0 auto;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 6px 4px 10px;
  position: relative;
  min-width: 84px;
  transition: transform 0.15s ease;
}

.cat:hover {
  transform: translateY(-2px);
}

.cat-img-wrap {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid transparent;
  padding: 2px;
  background: #fff;
  box-shadow: var(--shadow);
}

.cat.is-active .cat-img-wrap {
  border: 2px dashed var(--red);
  padding: 3px;
}

.cat-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.cat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.cat.is-active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  inset-inline-start: 50%;
  transform: translateX(50%);
  width: 60%;
  height: 3px;
  background: var(--red);
  border-radius: 3px 3px 0 0;
}

/* ----------------------------------------------------------------
   Menu
   ---------------------------------------------------------------- */

.menu {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

.menu-title {
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  margin: 8px 0 24px;
  color: var(--ink);
}

.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr 140px;
  align-items: stretch;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: 1px solid var(--border);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.card-body {
  padding: 16px 18px;
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
}

.card-name {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
}

.price-badge {
  display: inline-block;
  background: var(--red);
  color: #fff;
  padding: 4px 12px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 13px;
  align-self: flex-end;
  letter-spacing: 0.3px;
}

.card-cal {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.card-img-wrap {
  width: 140px;
  height: 100%;
  min-height: 130px;
  background: #eee;
}

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

.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}

/* ----------------------------------------------------------------
   Cart drawer
   ---------------------------------------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 90;
}

.overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.cart-drawer {
  position: fixed;
  top: 0;
  inset-inline-end: 0;
  height: 100%;
  width: 380px;
  max-width: 100%;
  background: #fff;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

html[dir="rtl"] .cart-drawer {
  transform: translateX(-100%);
}

.cart-drawer.open {
  transform: translateX(0);
}

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

.cart-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.cart-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: #f5f5f5;
  font-size: 20px;
}

.cart-close:hover {
  background: #eee;
}

.cart-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
}

.cart-empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}

.cart-item {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

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

.cart-item-img {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
}

.cart-item-name {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
}

.cart-item-line {
  margin: 0;
  font-size: 13px;
  color: var(--red);
  font-weight: 700;
}

.qty {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f5f5f5;
  border-radius: 999px;
  padding: 4px 6px;
}

.qty-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  font-size: 16px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.qty-btn:hover {
  background: var(--red);
  color: #fff;
}

.qty-val {
  min-width: 18px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
}

.cart-footer {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border);
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 800;
  font-size: 16px;
}

.cart-checkout {
  width: 100%;
  background: var(--red);
  color: #fff;
  padding: 14px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 15px;
  transition: background 0.15s ease;
}

.cart-checkout:hover:not(:disabled) {
  background: var(--red-dark);
}

.cart-checkout:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* ----------------------------------------------------------------
    Checkout Form
    ---------------------------------------------------------------- */

.cart-view.is-hidden,
.checkout-form.is-hidden {
  display: none;
}

.checkout-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.checkout-toggle {
  display: flex;
  gap: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--red);
  margin-bottom: 16px;
}

.toggle-btn {
  flex: 1;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  background: #fff;
  color: var(--red);
  transition: background 0.15s ease, color 0.15s ease;
}

.toggle-btn.is-active {
  background: var(--red);
  color: #fff;
}

.toggle-btn:hover:not(.is-active) {
  background: #fef2f2;
}

.checkout-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.checkout-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  background: #fafafa;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.checkout-input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.12);
}

.checkout-textarea {
  resize: vertical;
  min-height: 48px;
}

.checkout-error {
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  margin: 0 0 8px;
}

.checkout-send {
  margin-bottom: 8px;
}

.checkout-back {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: #fafafa;
  transition: background 0.15s ease;
}

.checkout-back:hover {
  background: #f0f0f0;
}

.delivery-fields-hidden {
  display: none;
}

.site-footer {
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 18px 16px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
}

.social {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.social a {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: #f5f5f5;
  color: var(--ink);
  transition: background 0.15s ease, color 0.15s ease;
}

.social a:hover {
  background: var(--red);
  color: #fff;
}

.social svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.copyright {
  text-align: end;
  font-size: 13px;
  color: var(--muted);
}

/* ----------------------------------------------------------------
   WhatsApp FAB
   ---------------------------------------------------------------- */

.wa-fab {
  position: fixed;
  bottom: 20px;
  inset-inline-start: 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border-radius: 999px;
  padding: 6px 14px 6px 6px;
  box-shadow: var(--shadow-lg);
  text-decoration: none;
  color: var(--ink);
  z-index: 80;
  transition: transform 0.15s ease;
}

.wa-fab:hover {
  transform: translateY(-2px);
}

.wa-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--whatsapp);
  display: inline-grid;
  place-items: center;
}

.wa-circle svg {
  width: 26px;
  height: 26px;
  fill: #fff;
}

.wa-text {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

/* ----------------------------------------------------------------
   Responsive
   ---------------------------------------------------------------- */

@media (max-width: 768px) {
  .header-inner {
    grid-template-columns: auto 1fr auto;
    gap: 8px;
  }

  .pill-btn {
    font-size: 13px;
    padding: 7px 12px;
  }

  .slider {
    aspect-ratio: 16 / 9;
  }

  .slider-btn {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

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

  .card {
    grid-template-columns: 1fr 120px;
  }

  .card-img-wrap {
    width: 120px;
    min-height: 120px;
  }

  .card-name {
    font-size: 15px;
  }

  .cart-drawer {
    width: 100%;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .social {
    justify-content: center;
  }

  .copyright {
    text-align: center;
  }

  .wa-text {
    display: none;
  }

  .wa-fab {
    padding: 0;
    background: transparent;
    box-shadow: none;
  }
}

.brand-logo-img {
  max-height: 60px;
  width: auto;
  height: auto;
  display: block;
}

@media (max-width: 768px) {
  .brand-logo-img {
    max-height: 48px;
  }
}

@media (max-width: 380px) {
  .brand-logo-img {
    max-height: 40px;
  }
  .brand-logo {
    font-size: 12px;
    padding: 6px 10px;
  }
  .pill-btn {
    font-size: 12px;
    padding: 6px 10px;
  }
  .card {
    grid-template-columns: 1fr 100px;
  }
  .card-img-wrap {
    width: 100px;
    min-height: 110px;
  }
}