/* ============================================================
   AYWAN TOOLS — REDESIGNED STYLE
   Theme: Industrial Luxury | Amber & Charcoal
   Font: Noto Kufi Arabic + Tajawal
============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Kufi+Arabic:wght@300;400;600;700;900&family=Tajawal:wght@300;400;500;700&display=swap');

/* ============================================================
   CSS VARIABLES — LIGHT MODE
============================================================ */
:root {
  /* Core palette */
  --bg:          #f0f4f8;
  --bg2:         #e4ecf4;
  --surface:     #ffffff;
  --surface2:    #f5f8fc;
  --surface3:    #e8eff7;
  --border:      #ccd6e4;
  --border2:     #b8c8dc;

  /* Text */
  --text:        #0f1923;
  --text2:       #445566;
  --text3:       #8899aa;

  /* Accent — amber/gold */
  --accent:      #1a6fc4;
  --accent2:     #2d8de8;
  --accent3:     #5aaff5;
  --accent-soft: rgba(26,111,196,0.10);
  --accent-text: #ffffff;

  /* Danger */
  --danger:      #c0392b;
  --danger-soft: rgba(192,57,43,0.10);

  /* Success */
  --success:     #1a7a4a;
  --success-soft:rgba(26,122,74,0.10);

  /* Shadows */
  --shadow:      0 2px 12px rgba(0,0,0,0.08);
  --shadow2:     0 6px 32px rgba(0,0,0,0.14);
  --shadow3:     0 12px 48px rgba(0,0,0,0.18);

  /* Shape */
  --radius:      14px;
  --radius-sm:   8px;
  --radius-xs:   5px;

  /* Typography */
  --font:        'Noto Kufi Arabic', 'Tajawal', sans-serif;

  /* Layout */
  --header-h:    70px;
  --cat-h:       56px;

  /* Motion */
  --ease:        cubic-bezier(0.4, 0, 0.2, 1);
  --transition:  0.22s var(--ease);

  /* Decorative stripe for headers */
  --stripe:      repeating-linear-gradient(
                   90deg,
                   transparent,
                   transparent 2px,
                   rgba(26,111,196,0.06) 2px,
                   rgba(26,111,196,0.06) 4px
                 );
}

/* ============================================================
   DARK MODE
============================================================ */
body.dark {
  --bg:          #141210;
  --bg2:         #1c1916;
  --surface:     #231f1b;
  --surface2:    #2b2621;
  --surface3:    #332e28;
  --border:      #3d3730;
  --border2:     #4d4640;

  --text:        #f0ece4;
  --text2:       #b0a898;
  --text3:       #6a6258;

  --accent:      #3b9eff;
  --accent2:     #64b5ff;
  --accent3:     #90cbff;
  --accent-soft: rgba(59,158,255,0.13);

  --danger:      #e74c3c;
  --danger-soft: rgba(231,76,60,0.12);

  --shadow:      0 2px 12px rgba(0,0,0,0.4);
  --shadow2:     0 6px 32px rgba(0,0,0,0.5);
  --shadow3:     0 12px 48px rgba(0,0,0,0.6);
}

/* ============================================================
   RESET
============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
}

body[data-lang="ar"],
body[data-lang="ku"] { direction: rtl; }

/* ============================================================
   HEADER
============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  box-shadow: var(--shadow);
  transition: background var(--transition), border-color var(--transition);
}

/* Accent bar along top of header */
.site-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2), var(--accent));
  background-size: 200% 100%;
  animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.header-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 28px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 46px; height: 46px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 14px rgba(26,111,196,0.35);
  flex-shrink: 0;
}

.logo-text { display: flex; flex-direction: column; gap: 2px; }

.logo-main {
  font-size: 17px;
  font-weight: 900;
  color: var(--text);
  letter-spacing: 0.04em;
  line-height: 1;
}

.logo-sub {
  font-size: 11px;
  color: var(--text3);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ---- Language Toggle ---- */
.lang-toggle {
  display: flex;
  background: var(--bg2);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--border);
}

.lang-btn {
  padding: 5px 13px;
  border: none;
  background: transparent;
  color: var(--text2);
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  transition: all var(--transition);
}

.lang-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(26,111,196,0.3);
}

/* ---- Theme Button ---- */
.theme-btn {
  width: 38px; height: 38px;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.theme-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  transform: rotate(12deg);
}

/* ---- Admin / Nav Links ---- */
.admin-link {
  padding: 7px 15px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font);
  white-space: nowrap;
  transition: all var(--transition);
  letter-spacing: 0.02em;
}
.admin-link:hover {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(26,111,196,0.3);
}

/* ============================================================
   CATEGORY NAV
============================================================ */
.category-nav {
  position: sticky;
  top: var(--header-h);
  z-index: 90;
  background: var(--bg2);
  border-bottom: 1.5px solid var(--border);
  height: var(--cat-h);
  transition: background var(--transition);
}

.cat-scroll {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 28px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.cat-scroll::-webkit-scrollbar { display: none; }

.cat-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 18px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all var(--transition);
  letter-spacing: 0.01em;
}
.cat-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.cat-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(26,111,196,0.3);
}

/* ============================================================
   SEARCH BAR
============================================================ */
.search-wrap {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  gap: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-icon { font-size: 1rem; opacity: 0.45; }

#searchInput {
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font);
  font-size: 0.92rem;
  color: var(--text);
  width: 180px;
  direction: rtl;
}
#searchInput::placeholder { color: var(--text3); }

/* ============================================================
   MAIN CONTENT & ITEMS GRID
============================================================ */
.main-content {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 32px 28px 80px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.section-header h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.01em;
  position: relative;
}

/* Gold underline on section title */
.section-header h2::after {
  content: '';
  position: absolute;
  bottom: -4px; right: 0;
  width: 32px; height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

.item-count {
  font-size: 12px;
  color: var(--text3);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ---- Items Grid ---- */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 20px;
}

/* ---- Item Card ---- */
.item-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  animation: fadeUp 0.35s var(--ease) both;
  position: relative;
}

.item-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 0 var(--accent);
  transition: box-shadow 0.22s;
  pointer-events: none;
  z-index: 1;
}

.item-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow2);
  border-color: var(--accent);
}

.item-card:hover::before {
  box-shadow: inset 0 3px 0 0 var(--accent);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Card image */
.item-img {
  height: 165px;
  background: linear-gradient(135deg, var(--surface2) 0%, var(--bg2) 100%);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Subtle grid texture */
.item-img::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(26,111,196,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26,111,196,0.04) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}

.item-img-real {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s var(--ease);
}
.item-card:hover .item-img-real { transform: scale(1.07); }

.item-img-emoji {
  font-size: 60px;
  z-index: 1;
}

/* Card body */
.item-body {
  padding: 14px 16px 18px;
}

.item-cat-badge {
  display: inline-flex;
  align-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--radius-xs);
  padding: 2px 9px;
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 7px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.item-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.45;
}

.item-price {
  font-size: 18px;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -0.01em;
  display: block;
}

.item-price-di {
  font-size: 13px;
  color: var(--success);
  font-weight: 600;
  margin-top: 3px;
}

/* ============================================================
   MODAL
============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14,10,6,0.70);
  backdrop-filter: blur(6px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal-card {
  background: var(--surface);
  border-radius: 20px;
  max-width: 420px;
  width: calc(100% - 32px);
  overflow: hidden;
  box-shadow: var(--shadow3);
  border: 1.5px solid var(--border2);
  transform: translateY(16px) scale(0.97);
  transition: transform 0.28s var(--ease);
  position: relative;
}
.modal-overlay.open .modal-card {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 14px; left: 14px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  z-index: 1;
}
.modal-close:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.modal-img-wrap {
  height: 240px;
  overflow: hidden;
  position: relative;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
}

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

.modal-img-placeholder {
  font-size: 72px;
  display: flex; align-items: center; justify-content: center;
}

/* Gold bar at top of modal image */
.modal-img-wrap::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.modal-info {
  padding: 22px 22px 24px;
}

.modal-info h3 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.3;
}

.modal-cat {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--accent-soft);
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 14px;
}

.modal-price {
  font-size: 26px;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.modal-price-di {
  font-size: 15px;
  color: var(--success);
  font-weight: 700;
  margin-top: 5px;
}

/* ============================================================
   LOADING & EMPTY STATES
============================================================ */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  gap: 16px;
  color: var(--text3);
}

.spinner {
  width: 38px; height: 38px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  gap: 14px;
  color: var(--text3);
}

.empty-icon { font-size: 56px; opacity: 0.4; }

/* ============================================================
   FOOTER
============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 28px;
  text-align: center;
  background: var(--surface);
  color: var(--text3);
  font-size: 13px;
  line-height: 1.8;
  margin-top: auto;
}

/* ============================================================
   PASSWORD GATE
============================================================ */
.password-gate {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 500;
}

/* Angled background decoration */
.password-gate::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 50%; height: 100%;
  background: linear-gradient(
    160deg,
    rgba(26,111,196,0.08) 0%,
    transparent 60%
  );
  pointer-events: none;
}

.gate-card {
  background: var(--surface);
  border: 1.5px solid var(--border2);
  border-radius: 20px;
  padding: 44px 36px 36px;
  max-width: 380px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow3);
  position: relative;
  text-align: center;
}

/* Gold top accent */
.gate-card::before {
  content: '';
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 0 0 4px 4px;
}

.gate-icon {
  font-size: 40px;
  margin-bottom: 16px;
  display: block;
}

.gate-card h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.gate-card p {
  font-size: 14px;
  color: var(--text3);
  margin-bottom: 24px;
}

.gate-input-wrap {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.gate-input {
  flex: 1;
  padding: 11px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg2);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  outline: none;
  letter-spacing: 4px;
  transition: border-color var(--transition), box-shadow var(--transition);
  direction: ltr;
  text-align: center;
}
.gate-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.gate-btn {
  padding: 11px 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  transition: all var(--transition);
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(26,111,196,0.3);
}
.gate-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 6px 20px rgba(200,120,0,0.4);
}

.gate-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 20px;
  margin-bottom: 12px;
  font-weight: 600;
}

.gate-back {
  display: inline-block;
  color: var(--text3);
  font-size: 13px;
  text-decoration: none;
  margin-bottom: 20px;
  transition: color var(--transition);
}
.gate-back:hover { color: var(--accent); }

.gate-lang {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}

/* ============================================================
   ADMIN PANEL
============================================================ */
.admin-panel { min-height: 100vh; }

/* Tabs */
.admin-tabs {
  max-width: 1320px;
  margin: 24px auto 0;
  padding: 0 28px;
  display: flex;
  gap: 8px;
  border-bottom: 1.5px solid var(--border);
  padding-bottom: 0;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 24px;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  transition: all var(--transition);
  letter-spacing: 0.02em;
  margin-bottom: -1.5px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.tab-btn:hover { color: var(--accent); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--accent-soft);
}

/* Admin main */
.admin-main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px;
}

.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.admin-section-header h2 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

/* Add button */
.add-btn {
  padding: 9px 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  transition: all var(--transition);
  box-shadow: 0 3px 12px rgba(26,111,196,0.25);
  letter-spacing: 0.02em;
}
.add-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 5px 18px rgba(26,111,196,0.35);
}

/* Form card */
.form-card {
  background: var(--surface);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  animation: slideDown 0.22s var(--ease);
  box-shadow: 0 4px 24px rgba(26,111,196,0.08);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.form-card h3 {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 20px;
  color: var(--accent);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-input {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg2);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Image upload */
.img-upload-group { width: 100%; }

.img-upload-area {
  border: 2px dashed var(--border2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  overflow: hidden;
  position: relative;
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.img-upload-area:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.img-preview-wrap {
  position: relative;
  width: 100%;
}
.img-preview-wrap img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
}

.img-remove-btn {
  position: absolute;
  top: 8px; left: 8px;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(14,10,6,0.6);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.img-remove-btn:hover { background: var(--danger); }

.img-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 20px;
  pointer-events: none;
}
.img-upload-icon { font-size: 32px; opacity: 0.5; }
.img-upload-area span { font-size: 13px; color: var(--text2); font-weight: 600; }
.img-upload-hint { font-size: 11px !important; color: var(--text3) !important; font-weight: 400 !important; }

/* Form actions */
.form-actions { display: flex; gap: 10px; }

.save-btn {
  padding: 10px 26px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  transition: all var(--transition);
  box-shadow: 0 3px 12px rgba(26,111,196,0.25);
}
.save-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 5px 16px rgba(26,111,196,0.35);
}

.cancel-btn {
  padding: 10px 20px;
  background: var(--surface2);
  color: var(--text2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition);
}
.cancel-btn:hover {
  background: var(--border);
  color: var(--text);
}

/* Table */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--surface);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table thead {
  background: var(--stripe), var(--surface2);
}

.admin-table th {
  padding: 13px 16px;
  text-align: right;
  font-weight: 700;
  color: var(--text2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1.5px solid var(--border);
}

.admin-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr { transition: background var(--transition); }
.admin-table tbody tr:hover { background: var(--accent-soft); }

/* Table image thumbnail */
.table-thumb {
  width: 44px; height: 44px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  border: 1px solid var(--border);
}
.table-thumb-empty {
  width: 44px; height: 44px;
  border-radius: var(--radius-xs);
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}

/* Action buttons */
.action-btns { display: flex; gap: 7px; }

.edit-btn, .del-btn {
  padding: 5px 14px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  transition: all var(--transition);
  letter-spacing: 0.02em;
}

.edit-btn {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1.5px solid var(--accent);
}
.edit-btn:hover {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(26,111,196,0.3);
}

.del-btn {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1.5px solid var(--danger);
}
.del-btn:hover {
  background: var(--danger);
  color: #fff;
}

/* Logout */
.logout-btn {
  padding: 7px 14px;
  background: var(--danger-soft);
  color: var(--danger);
  border: 1.5px solid var(--danger);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  transition: all var(--transition);
}
.logout-btn:hover { background: var(--danger); color: #fff; }

/* DB notice */
.db-notice {
  background: var(--accent-soft);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 13px 18px;
  margin: 16px auto;
  font-size: 13px;
  color: var(--text2);
  max-width: 1320px;
}
.db-notice strong { color: var(--accent); }

/* ============================================================
   ORDER PAGE — EXTRA STYLES
============================================================ */
.order-layout {
  display: grid;
  grid-template-columns: 1fr 390px;
  gap: 24px;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 28px 60px;
}
@media (max-width: 900px) {
  .order-layout { grid-template-columns: 1fr; }
}

.panel-heading {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.01em;
}

/* Search */
.order-search-wrap {
  position: relative;
  margin-bottom: 16px;
}
.order-search-wrap input {
  width: 100%;
  padding: 11px 44px 11px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.93rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.order-search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.order-search-wrap .si {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  pointer-events: none;
}
body[data-lang="ar"] .order-search-wrap .si,
body[data-lang="ku"] .order-search-wrap .si { left: unset; right: 14px; }
body[data-lang="ar"] .order-search-wrap input,
body[data-lang="ku"] .order-search-wrap input { padding: 11px 44px 11px 16px; }

/* Cat chips */
.order-cat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.order-cat-chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.order-cat-chip:hover { border-color: var(--accent); color: var(--accent); }
.order-cat-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(26,111,196,0.3);
}

/* Products grid */
.order-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(162px, 1fr));
  gap: 14px;
}

.order-product-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}
.order-product-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 18px rgba(26,111,196,0.15);
  transform: translateY(-3px);
}
.order-product-card .opc-img {
  width: 100%; aspect-ratio: 1/1;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface2);
  overflow: hidden;
}
.order-product-card .opc-img img { width: 100%; height: 100%; object-fit: cover; }
.order-product-card .opc-img .opc-emoji { font-size: 2.2rem; }
.order-product-card .opc-body {
  padding: 9px 10px 11px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.order-product-card .opc-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.order-product-card .opc-price {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--accent);
  margin-top: auto;
}
.order-product-card .opc-add-btn {
  margin: 0 10px 10px;
  padding: 7px;
  border-radius: var(--radius-sm);
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(26,111,196,0.2);
}
.order-product-card .opc-add-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 3px 12px rgba(26,111,196,0.3);
}

/* ---- Order Panel (Cart) ---- */
.order-panel {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  height: fit-content;
  position: sticky;
  top: calc(var(--header-h) + 16px);
  box-shadow: var(--shadow);
}

/* Amber left border accent */
.order-panel {
  border-right: 4px solid var(--accent);
}

.order-panel-title {
  font-size: 1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.01em;
}

/* Customer row */
.order-customer-row { margin-bottom: 14px; }
.order-customer-row label {
  display: block;
  font-size: 0.78rem;
  color: var(--text2);
  margin-bottom: 5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.order-customer-row input {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.order-customer-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface);
}

/* Cart list */
.cart-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 40px;
  margin-bottom: 14px;
}
.cart-empty {
  text-align: center;
  color: var(--text3);
  font-size: 0.88rem;
  padding: 20px 0;
  line-height: 2;
}

.cart-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  animation: fadeIn 0.2s var(--ease);
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cart-item-img {
  width: 40px; height: 40px;
  border-radius: var(--radius-xs);
  overflow: hidden;
  background: var(--bg2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.cart-item-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-item-img .ci-emoji { font-size: 1.2rem; }

.cart-item-info { min-width: 0; }
.cart-item-name {
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.cart-item-sub { font-size: 0.73rem; color: var(--text3); }

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.qty-btn {
  width: 26px; height: 26px;
  border-radius: var(--radius-xs);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  font-family: var(--font);
}
.qty-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.qty-val {
  font-size: 0.85rem;
  font-weight: 800;
  min-width: 20px;
  text-align: center;
}

.cart-item-remove {
  width: 22px; height: 22px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.cart-item-remove:hover { background: var(--danger-soft); color: var(--danger); }

/* Discount */
.discount-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.discount-row input {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition);
}
.discount-row input:focus {
  border-color: var(--accent);
}
.discount-apply-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--surface2);
  color: var(--text2);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  border: 1.5px solid var(--border);
}
.discount-apply-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* Cart summary */
.cart-summary {
  border-top: 1.5px solid var(--border);
  padding-top: 14px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cart-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  color: var(--text2);
}
.cart-summary-row.total {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  border-top: 1px dashed var(--border);
  padding-top: 10px;
  margin-top: 4px;
}
.cart-summary-row.total .amount {
  color: var(--accent);
  font-size: 1.15rem;
}

/* Cart actions */
.cart-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.print-btn, .whatsapp-btn, .clear-btn {
  width: 100%;
  padding: 11px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition);
}

.print-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 3px 12px rgba(26,111,196,0.25);
}
.print-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 5px 18px rgba(26,111,196,0.35);
}

.whatsapp-btn {
  background: linear-gradient(135deg, #1a7a4a, #22a060);
  color: #fff;
  box-shadow: 0 3px 10px rgba(26,122,74,0.25);
}
.whatsapp-btn:hover { transform: scale(1.02); }

.clear-btn {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1.5px solid var(--danger);
}
.clear-btn:hover { background: var(--danger); color: #fff; }

/* ============================================================
   PRINT STYLES — RECEIPT
============================================================ */
#printArea { display: none; }

@media print {
  body > *:not(#printArea) { display: none !important; }
  #printArea {
    display: block !important;
    position: fixed;
    inset: 0;
    z-index: 9999;
  }

  .receipt {
    font-family: 'Noto Kufi Arabic', 'Tajawal', Arial, sans-serif;
    direction: rtl;
    max-width: 800px;
    margin: 0 auto;
    padding: 30px 28px;
    color: #111;
    background: #fff;
  }

  .receipt-header { text-align: center; margin-bottom: 20px; }

  .rh-brand {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    color: #1c1712;
    margin-bottom: 4px;
  }

  .rh-sub { font-size: 0.88rem; color: #666; margin-bottom: 10px; }
  .rh-divider { border: none; border-top: 2px solid #1c1712; margin: 10px 0; }

  .rh-meta {
    display: flex;
    justify-content: center;
    gap: 16px;
    font-size: 0.82rem;
    color: #555;
    flex-wrap: wrap;
  }
  .rh-meta span { white-space: nowrap; }

  .receipt-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
  }
  .receipt-table th {
    background: #f0f0f0;
    padding: 8px 10px;
    text-align: right;
    font-size: 0.83rem;
    font-weight: 700;
    border-bottom: 1.5px solid #ccc;
  }
  .receipt-table td {
    padding: 8px 10px;
    font-size: 0.83rem;
    border-bottom: 1px solid #e8e8e8;
  }
  .receipt-table tbody tr:last-child td { border-bottom: none; }
  .receipt-table .td-price { color: #1a6fc4; font-weight: 700; }
  .receipt-table .td-price-di { color: #16a34a; font-weight: 600; font-size: 0.78rem; }

  .pr-di { color: #16a34a; font-weight: 700; }
  .summary-di { color: #16a34a; font-size: 0.78rem; font-weight: 600; display: block; margin-top: 2px; }

  .receipt-totals {
    border-top: 2px solid #111;
    padding-top: 14px;
  }
  .receipt-totals .rt-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.88rem;
    color: #444;
    margin-bottom: 6px;
  }
  .receipt-totals .rt-row.grand {
    font-size: 1.1rem;
    font-weight: 900;
    color: #000;
    border-top: 1px dashed #aaa;
    padding-top: 10px;
    margin-top: 8px;
  }

  .receipt-footer {
    text-align: center;
    margin-top: 28px;
    padding-top: 14px;
    border-top: 1px dashed #aaa;
    font-size: 0.78rem;
    color: #888;
  }
  .receipt-footer .rf-thanks {
    font-size: 0.9rem;
    font-weight: 800;
    color: #333;
    margin-bottom: 4px;
  }
}

/* ============================================================
   RESPONSIVE — MOBILE
============================================================ */
@media (max-width: 640px) {

  /* Header */
  .site-header { height: auto; min-height: var(--header-h); }
  .header-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 14px;
    gap: 8px;
  }
  .logo-area { flex: 1; min-width: 0; }
  .logo-main { font-size: 15px; }
  .logo-sub  { font-size: 10px; }
  .header-controls {
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
  }
  .lang-toggle { flex-shrink: 0; }
  .lang-btn    { font-size: 11px; padding: 4px 8px; }
  .theme-btn   { width: 32px; height: 32px; font-size: 15px; flex-shrink: 0; }
  .admin-link  { font-size: 11px; padding: 5px 9px; white-space: nowrap; flex-shrink: 0; }
  .logout-btn  { font-size: 11px; padding: 5px 9px; flex-shrink: 0; }

  /* Cat bar */
  .category-nav { height: auto; top: auto; }
  .cat-scroll { height: auto; padding: 8px 12px; gap: 6px; }
  .cat-chip   { font-size: 12px; padding: 6px 13px; }

  /* Section header */
  .section-header { padding: 10px 14px 4px; margin-bottom: 12px; gap: 8px; }
  .section-header h2 { font-size: 16px; }
  .search-wrap { width: 100%; order: 3; margin-top: 4px; }
  #searchInput { width: 100%; }

  /* Grid */
  .main-content { padding: 12px 12px 60px; }
  .items-grid   { grid-template-columns: 1fr 1fr; gap: 10px; }
  .item-img     { height: 120px; }
  .item-name    { font-size: 13px; }
  .item-price   { font-size: 15px; }

  /* Admin tabs */
  .admin-tabs { flex-wrap: nowrap; gap: 4px; padding: 12px 14px 0; }
  .tab-btn    { flex: 1; justify-content: center; padding: 8px 10px; font-size: 12px; }
  .admin-main { padding: 14px; }
  .admin-section-header { flex-wrap: wrap; gap: 8px; }
  .add-btn    { font-size: 12px; padding: 7px 14px; }
  .form-card  { padding: 16px; }
  .form-grid  { grid-template-columns: 1fr; }

  /* Table */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .admin-table { min-width: 460px; }
  .admin-table th,
  .admin-table td { padding: 10px 8px; font-size: 12px; }
  .table-thumb, .table-thumb-empty { width: 38px; height: 38px; }
  .edit-btn, .del-btn { font-size: 11px; padding: 4px 9px; }

  /* Gate */
  .gate-card       { padding: 28px 18px; }
  .gate-input-wrap { flex-direction: column; }
  .gate-input      { width: 100%; }

  /* Order page */
  .order-layout { padding: 14px 12px 60px; }
}
