/* app/static/css/styles.css */
/* ===================================================================
   Warda UI – Clean, professional, sharp corners, RTL-aware, responsive
   =================================================================== */

/* ---------- CSS Variables (Light / Dark) ---------- */
:root {
  --bg: #ffffff;
  --surface: #f7f7f8;
  --surface-2: #f2f2f3;
  --text: #16181b;
  --muted: #60646c;
  --line: #e6e7ea;
  --brand: #1f6feb;         /* primary */
  --brand-600: #1a5ece;
  --accent: #0ea5e9;        /* secondary */
  --danger: #e11d48;
  --success: #16a34a;
  --warning: #f59e0b;

  --card-bg: #ffffff;
  --card-shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.06);

  --radius-sm: 6px;
  --radius: 10px;           /* sharp but a bit soft */
  --radius-lg: 14px;

  --container: 1200px;
  --transition: 160ms ease;
  --focus: 0 0 0 3px rgba(31,111,235,.25);

  --badge-bg: #eef2ff;
  --badge-text: #1f3aed;

  --price-old: #8a8f98;
}

/* Dark mode (optional) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0c0f;
    --surface: #111317;
    --surface-2: #171b21;
    --text: #f4f5f6;
    --muted: #b6bac2;
    --line: #242832;
    --brand: #69a4ff;
    --brand-600: #5a90e2;
    --accent: #5ad1ff;
    --danger: #ff5577;
    --success: #34d399;
    --warning: #fbbf24;

    --card-bg: #0f1115;
    --card-shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);

    --badge-bg: #1a2238;
    --badge-text: #9fb5ff;

    --price-old: #8d93a0;
  }
}

/* RTL tweaks */
html[dir="rtl"] body {
  font-feature-settings: "liga", "kern";
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  padding: 0; margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 system-ui, -apple-system, Segoe UI, Roboto, "Noto Kufi Arabic", "Tahoma", Arial, sans-serif;
  text-rendering: optimizeLegibility;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 16px;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; gap: 12px;
  min-height: 64px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; letter-spacing: .2px;
  text-decoration: none; color: var(--text);
  font-size: 18px;
}
.nav {
  margin-inline-start: auto;
  display: flex; align-items: center; gap: 10px;
}
.nav a {
  text-decoration: none;
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}
.nav a:hover { background: var(--surface-2); }

/* Footer */
.footer {
  margin-top: 48px;
  border-top: 1px solid var(--line);
  padding: 24px 0 48px;
  color: var(--muted);
}

/* ---------- Utilities ---------- */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
@media (min-width: 768px) {
  .grid { gap: 20px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--badge-bg);
  color: var(--badge-text);
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
  transition: transform var(--transition), background var(--transition), box-shadow var(--transition);
  box-shadow: 0 1px 1px rgba(0,0,0,.04), 0 6px 18px rgba(31,111,235,.18);
}
.btn:hover { background: var(--brand-600); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
  box-shadow: none;
}
.btn-outline:hover {
  background: var(--surface-2);
}

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #cc123e; }

.btn-muted {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn-muted:hover { background: var(--surface-2); }

/* Icon button (cart, etc.) */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}
.icon-btn:hover { background: var(--surface-2); }

/* ---------- Cards ---------- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  overflow: clip;   /* keep sharp edges */
  display: flex; flex-direction: column;
}

.card-media {
  aspect-ratio: 4 / 3;
  width: 100%;
  background: var(--surface-2);
  overflow: hidden;
}
.card-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;          /* equal cropping */
  object-position: center;
}

.card-body {
  padding: 12px 12px 14px;
  display: flex; flex-direction: column; gap: 10px;
}

.card-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 800;
}

.tags { display: flex; gap: 6px; flex-wrap: wrap; }

.price {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 16px; font-weight: 800;
}
.price .old {
  color: var(--price-old);
  text-decoration: line-through;
  font-weight: 600;
}
.price .new { color: var(--text); }

.card-actions {
  margin-top: 2px;
  display: flex; gap: 8px; flex-wrap: wrap;
}

/* Discount bubble (optional) */
.discount {
  position: absolute;
  inset-inline-end: 10px;
  inset-block-start: 10px;
  background: #fff1f1;
  color: #9a1a1a;
  border: 1px solid #f3bcbc;
  padding: 4px 8px;
  border-radius: var(--radius);
  font-weight: 800;
  font-size: 12px;
  box-shadow: 0 4px 10px rgba(154,26,26,.08);
}

/* ---------- Forms ---------- */
label { font-weight: 700; font-size: 13px; display: inline-block; margin: 6px 0; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: var(--radius);
  padding: 10px 12px;
  transition: border var(--transition), box-shadow var(--transition);
}
textarea { min-height: 110px; resize: vertical; }

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--brand-600);
  box-shadow: var(--focus);
}

.form-row { display: grid; gap: 12px; }
@media (min-width: 768px) {
  .form-row.cols-2 { grid-template-columns: repeat(2, 1fr); }
  .form-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Tables (admin, orders) ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.table th, .table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: start;
  vertical-align: middle;
}
.table thead th {
  background: var(--surface);
  font-weight: 800;
  font-size: 13px;
}
.table tr:hover td { background: var(--surface-2); }

/* ---------- Alert / Flash ---------- */
.alert {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 12px 14px;
  border-radius: var(--radius);
  font-weight: 600;
}
.alert.info { border-color: #c7ddff; background: #eef5ff; color: #0b3a8a; }
.alert.error { border-color: #ffd0d6; background: #fff2f5; color: #7f1129; }
.alert.success { border-color: #cdeccf; background: #ebfbec; color: #0f6a1f; }
.alert.warn { border-color: #ffe2b7; background: #fff6e7; color: #7a4a00; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(180deg, var(--surface) 0%, transparent 100%);
  border-bottom: 1px solid var(--line);
  padding: 32px 0 24px;
}
.hero h1 {
  margin: 0 0 8px;
  font-weight: 900; font-size: 26px;
}
.hero p { margin: 0; color: var(--muted); }

/* ---------- Product detail ---------- */
.product {
  display: grid; gap: 16px;
}
@media (min-width: 960px) {
  .product { grid-template-columns: 1.05fr .95fr; gap: 24px; }
}
.gallery {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card-bg);
  overflow: hidden;
}
.gallery-main {
  aspect-ratio: 4 / 3;
  width: 100%; background: var(--surface-2);
}
.gallery-main img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-thumbs {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 8px; padding: 8px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.gallery-thumbs button {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden; cursor: pointer; padding: 0;
  aspect-ratio: 1 / 1;
}
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Account / Auth ---------- */
.account-menu {
  display: flex; gap: 8px; flex-wrap: wrap;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 8px;
  border-radius: var(--radius);
}
.status-badge {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
/* === Palette & Tokens (سريعة) === */
:root{
  --bg:#faf9f8; --card:#ffffff; --ink:#1b1b1f; --muted:#6b7280;
  --brand:#3b82f6; --brand-ink:#0b3b91; --ok:#16a34a; --sale:#b42318;
  --line:#e7e7ea; --shadow:0 8px 20px rgba(16,24,40,.08);
}

/* شبكة المنتجات */
.grid{display:grid; gap:24px; grid-template-columns:repeat(auto-fill,minmax(260px,1fr));}

/* كرت المنتج */
.card.product-card{
  background:var(--card);
  border:1px solid var(--line);
  box-shadow:var(--shadow);
  border-radius:16px; overflow:hidden;
  display:flex; flex-direction:column;
  transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card.product-card:hover{transform:translateY(-2px); box-shadow:0 12px 28px rgba(16,24,40,.12); border-color:#ddd;}

/* الميديا بنسبة ثابتة (مثل UrbanStems: صور طويلة جذابة) */
.product-media{display:block; position:relative; background:#f5f5f7;}
.product-media img{
  width:100%; height:auto; aspect-ratio:4/5; object-fit:cover; display:block;
}
.ribbon{
  position:absolute; top:12px; left:12px; padding:4px 8px; font-size:12px; font-weight:600;
  border-radius:999px; background:#fff; border:1px solid var(--line); color:var(--ink);
}
.ribbon.-sale{background:#fff1f1; border-color:#ffdede; color:var(--sale);}

/* جسم الكرت */
.product-body{padding:12px 14px 14px;}
.product-title{font-size:16px; font-weight:700; color:var(--ink); margin:2px 0 8px;}
.meta{margin-bottom:6px;}
.badge.-soft{background:#f3f4f6; color:#374151; border:1px solid #e5e7eb; padding:2px 8px; border-radius:999px; font-size:12px;}

.price-row{display:flex; align-items:center; gap:10px; margin:.25rem 0 .75rem;}
.price{font-weight:700;}
.price.-new{color:var(--ok);}
.price.-old{color:var(--muted); text-decoration:line-through;}

/* أزرار خفيفة ومحترفة */
.btn{--b:var(--brand); --bi:var(--brand-ink); display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:10px 14px; border-radius:12px; border:1px solid var(--line); background:#fff; color:var(--ink);
  font-weight:600; cursor:pointer; transition:all .18s ease;}
.btn:hover{border-color:#d9d9de;}
.btn:active{transform:translateY(1px);}
.btn.-primary{background:var(--b); color:#fff; border-color:transparent;}
.btn.-primary:hover{background:var(--bi);}
.btn.-ghost{background:#fff; color:var(--ink);}

/* سطر واحد */
.line-1{white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.promo-bar{background:#111827; color:#fff; font-size:13px;}
.promo-bar .container{padding:8px 0; text-align:center;}
.site-header{background:#fff; border-bottom:1px solid var(--line); position:sticky; top:0; z-index:50;}
.topnav.container{display:flex; align-items:center; gap:16px; justify-content:space-between; padding:14px 0;}
.brand{font-weight:800; letter-spacing:.3px; font-size:18px;}
.lang a.badge{background:#f8fafc; border:1px solid #e5e7eb; border-radius:10px; padding:4px 8px; font-size:12px;}
