/* =============================================
   متجر السمك الطازج — style.css
   ============================================= */

/* ===== RESET & BASE ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --primary:       #0C447C;
  --primary-light: #E6F1FB;
  --primary-mid:   #378ADD;
  --accent:        #0F6E56;
  --accent-light:  #E1F5EE;
  --danger:        #E24B4A;
  --text:          #2C2C2A;
  --text-muted:    #888780;
  --border:        #D3D1C7;
  --bg:            #F1EFE8;
  --card:          #ffffff;
}

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== PHONE FRAME (centres content on desktop) ===== */
.phone-frame {
  max-width: 430px;
  margin: 0 auto;
  background: var(--bg);
  min-height: 100vh;
  position: relative;
  padding-bottom: 70px; /* space for bottom-nav */
}

/* =============================================
   HEADER
   ============================================= */
.app-header {
  background: var(--primary);
  padding: 16px 16px 20px;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.header-greeting {
  font-size: 13px;
  opacity: 0.8;
}

.header-title {
  font-size: 18px;
  font-weight: 700;
}

.header-cart-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 20px;
  position: relative;
}

.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* Search bar */
.search-bar {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
}

.search-bar input {
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-size: 14px;
  font-family: 'Cairo', sans-serif;
  flex: 1;
  direction: rtl;
}

.search-bar input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.search-icon {
  color: rgba(255, 255, 255, 0.7);
  font-size: 18px;
}

/* =============================================
   SECTIONS
   ============================================= */
.section {
  padding: 16px;
}

.no-bottom-pad {
  padding-bottom: 0;
}

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

.section-title {
  font-size: 16px;
  font-weight: 700;
}

/* =============================================
   CATEGORIES
   ============================================= */
.cats {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.cats::-webkit-scrollbar {
  display: none;
}

.cat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  min-width: 64px;
  user-select: none;
}

.cat-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  border: 2px solid transparent;
  transition: border-color 0.2s, background 0.2s;
  background: var(--card);
  border-color: var(--border);
}

.cat-icon.active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.cat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
}

.cat-pill.active .cat-label {
  color: var(--primary);
  font-weight: 700;
}

/* =============================================
   PROMO BANNER
   ============================================= */
.banner {
  margin: 12px 16px;
  background: linear-gradient(135deg, #0C447C, #185FA5);
  border-radius: 16px;
  padding: 18px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.banner-text h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.banner-text p {
  font-size: 12px;
  opacity: 0.85;
  margin-bottom: 12px;
  line-height: 1.6;
}

.banner-btn {
  background: #fff;
  color: var(--primary);
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
}

.banner-emoji {
  font-size: 56px;
  line-height: 1;
}

/* =============================================
   PRODUCTS GRID
   ============================================= */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.product-card {
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  border: 0.5px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s;
}

.product-card:active {
  transform: scale(0.97);
}

/* Product image area */
.prod-img {
  height: 115px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 54px;
  background: var(--primary-light);
  position: relative;
  overflow: hidden;
}
.prod-img img {
  width: 90%;
  height: 90%;
  object-fit: contain;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Badges on card image */
.prod-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 700;
}

.prod-badge.fresh {
  background: var(--accent);
  right: auto;
  left: 8px;
}

/* Product info */
.prod-info {
  padding: 10px;
}

.prod-name {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 2px;
}

.prod-weight {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.prod-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.prod-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
}

.prod-price span {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

.add-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary);
  border: none;
  color: #fff;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 300;
  line-height: 1;
}

/* Empty state */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 36px 0;
  color: var(--text-muted);
  font-size: 15px;
}

/* =============================================
   BOTTOM NAVIGATION
   ============================================= */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  background: var(--card);
  border-top: 0.5px solid var(--border);
  display: flex;
  padding: 8px 0 14px;
  z-index: 50;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  border: none;
  background: none;
  font-family: 'Cairo', sans-serif;
}

.nav-icon {
  font-size: 22px;
  color: var(--text-muted);
}

.nav-icon.active {
  color: var(--primary);
}

.nav-label {
  font-size: 10px;
  color: var(--text-muted);
}

.nav-item.active .nav-label {
  color: var(--primary);
  font-weight: 700;
}

/* =============================================
   CART OVERLAY / BOTTOM SHEET
   ============================================= */
.cart-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 100;
  align-items: flex-end;
  justify-content: center;
}

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

.cart-sheet {
  background: var(--card);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 430px;
  padding: 20px;
  max-height: 75vh;
  overflow-y: auto;
}

.cart-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  margin: 0 auto 16px;
}

.cart-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
}

/* Cart items */
.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--border);
}

.cart-item-emoji {
  font-size: 30px;
  background: var(--primary-light);
  border-radius: 10px;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.cart-item-name {
  font-size: 13px;
  font-weight: 700;
}

.cart-item-price {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Quantity controls */
.qty-ctrl {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 0.5px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cairo', sans-serif;
}

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

/* Cart total */
.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0 4px;
  font-size: 15px;
  font-weight: 700;
}

#totalPrice {
  font-size: 18px;
  color: var(--primary);
}

/* Checkout button */
.checkout-btn {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

/* Empty cart */
.empty-cart {
  text-align: center;
  padding: 36px 0;
  color: var(--text-muted);
}

.empty-cart-icon {
  font-size: 52px;
  margin-bottom: 8px;
}

/* =============================================
   TOAST NOTIFICATION
   ============================================= */
.toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: #2C2C2A;
  color: #fff;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-family: 'Cairo', sans-serif;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  z-index: 200;
  white-space: nowrap;
}

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

/* =============================================
   RESPONSIVE — full screen on real phones
   ============================================= */
@media (max-width: 430px) {
  .phone-frame {
    max-width: 100%;
  }
  .bottom-nav {
    max-width: 100%;
  }
  .cart-sheet {
    max-width: 100%;
  }
}

/* =============================================
   MODALS
   ============================================= */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 100;
  align-items: flex-end;
  justify-content: center;
}

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

.modal-sheet {
  background: var(--card);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 430px;
  padding: 20px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-img-wrap {
  margin-bottom: 14px;
  border-radius: 12px;
  overflow: hidden;
}

.modal-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  text-align: center;
}

.modal-price {
  font-size: 15px;
  color: var(--primary);
  font-weight: 700;
  text-align: center;
  margin-bottom: 16px;
}

.modal-qty-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 600;
}

.modal-qty-ctrl {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Add product form */
.add-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.add-form label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 6px;
}

.add-form input,
.add-form select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  outline: none;
}

.add-form input:focus,
.add-form select:focus {
  border-color: var(--primary);
}


/* ACCOUNT */
.account-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-top: 10px;
}

.order-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.order-status {
  background: var(--primary-light);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}

.order-date {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 6px;
}

.order-total {
  margin-top: 8px;
  font-weight: 700;
  color: var(--primary);
}

/* ===== Delete product button (admin only) ===== */
.del-product-btn {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--danger);
  color: #fff;
  border: 2px solid #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.del-product-btn:active { transform: translateX(-50%) scale(0.92); }
