/* Pakistan Knives Factory — storefront + admin styles
   Direction: modern e-commerce, épuré, warmed with blood red accent. */

:root {
  --bg: #fdfbf8;
  --text: #1c1512;
  --muted: #6b5f57;
  --accent: #7a1f1f;
  --accent-dark: #5e1717;
  --green: #1f4d3a;
  --damascus: #a3672b;
  --damascus-dark: #7c4d1e;
  --panel: #f6f0ea;
  --border: #e9ddd2;
  --label-light: #9c9084;
  --input-dark: #3a332e;
  --card-border: #cdbfae;
  --radius: 12px;
  --max-width: 1200px;
  --footer-bg: #e3d5c2;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Sora', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
a:hover { opacity: 0.75; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
}
.logo { display: flex; align-items: center; }
.logo img { height: 40px; width: auto; display: block; }
.brand { display: flex; align-items: center; gap: 20px; }
.brand-title { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.4; }
.brand-title span { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); letter-spacing: 0.01em; margin-top: 2px; }
.header-actions { display: flex; gap: 18px; align-items: center; }
.icon-btn {
  background: none; border: none; cursor: pointer; padding: 6px;
  color: var(--text); display: flex; align-items: center; position: relative;
}
.cart-count {
  position: absolute; top: -4px; right: -6px; background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700; border-radius: 50%; width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
}

/* Horizontal category nav with submenu dropdowns, above the page H1 */
.main-nav {
  background: linear-gradient(
    to right,
    var(--bg) 0, var(--bg) calc(50% - var(--max-width) / 2),
    var(--footer-bg) calc(50% - var(--max-width) / 2 + 80px), var(--footer-bg) calc(50% + var(--max-width) / 2 - 80px),
    var(--bg) calc(50% + var(--max-width) / 2), var(--bg) 100%
  );
}
.main-nav .container {
  display: flex; gap: 30px; flex-wrap: wrap; justify-content: center; padding: 12px 24px;
}
.main-nav .nav-item > a {
  font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text);
}

/* Both nav rows get an animated red underline on hover, so the customer
   always sees exactly what they're pointing at. */
.main-nav .nav-item > a,
.sub-nav a {
  position: relative;
  display: inline-block;
  padding-bottom: 5px;
}
.main-nav .nav-item > a::after,
.sub-nav a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  transition: width 0.2s ease;
}
.main-nav .nav-item > a:hover::after,
.sub-nav a:hover::after,
.sub-nav a.active::after {
  width: 100%;
}

/* Always-visible (no hover) subcategory bar for whichever category is active */
.sub-nav {
  display: flex; align-items: center; justify-content: center; gap: 20px; flex-wrap: wrap;
  padding: 12px 24px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  font-size: 11.5px;
}
.sub-nav a { color: var(--text); font-weight: 700; }
.sub-nav a:hover { color: var(--accent); }
.sub-nav a.active { color: var(--accent); font-weight: 700; }
.sub-nav a.damascus { color: var(--damascus); }
.sub-nav a.damascus:hover { color: var(--damascus-dark); }
.sub-nav a.damascus.active { color: var(--damascus-dark); }

/* Floating WhatsApp button */
.whatsapp-float {
  position: fixed; bottom: 24px; right: 24px; width: 56px; height: 56px;
  background: #25d366; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25); z-index: 100; transition: transform 0.15s ease;
}
.whatsapp-float:hover { transform: scale(1.07); }

/* Buttons */
.btn {
  display: inline-block; padding: 14px 28px; border-radius: var(--radius);
  font-size: 13px; letter-spacing: 0.03em; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; text-align: center;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); opacity: 1; }
.btn-outline { background: transparent; border-color: var(--text); color: var(--text); }
.btn-sm { padding: 9px 16px; font-size: 12.5px; }
.btn-whatsapp {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 22px; border-radius: 8px; background: #1fa855; color: #fff;
  font-size: 13.5px; font-weight: 600; letter-spacing: 0.01em;
  box-shadow: 0 1px 2px rgba(28,21,18,0.08); border: 1px solid rgba(0,0,0,0.06);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.btn-whatsapp:hover { background: #188c45; box-shadow: 0 2px 6px rgba(28,21,18,0.14); }
.wa-lead-form { display: none; max-width: 320px; margin-top: 12px; }
#wa-buy-block.wa-open > .btn-whatsapp { display: none; }
#wa-buy-block.wa-open .wa-lead-form { display: block; }
.btn-danger { background: transparent; border-color: var(--accent); color: var(--accent); }

/* Hero */
.hero {
  display: flex; align-items: center; gap: 64px; padding: 72px 0; border-bottom: 1px solid var(--border);
}
.hero-text { flex: 1; display: flex; flex-direction: column; gap: 22px; }
.eyebrow { font-size: 12.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.hero h2 { margin: 0; font-size: 38px; line-height: 1.15; font-weight: 700; }
.hero p { margin: 0; color: var(--muted); max-width: 440px; font-size: 16px; }
.hero-visual {
  flex: 1; min-height: 380px; border-radius: var(--radius);
  background: linear-gradient(135deg, #f3e6da, #e7cdb8);
  display: flex; align-items: center; justify-content: center; color: var(--muted);
  font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  position: relative; overflow: hidden;
}
.hero-visual img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  background: #fff; opacity: 0; transition: opacity 0.6s ease;
}
.hero-visual img.active { opacity: 1; }

/* Category pills */
.categories { display: flex; gap: 16px; flex-wrap: wrap; padding: 40px 0; }
.category-pill {
  flex: 1 1 180px; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
}
.category-pill .name { font-weight: 600; font-size: 14.5px; }
.category-pill .desc { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.thumb-cycle {
  position: relative; width: 100%; aspect-ratio: 1 / 1; border-radius: calc(var(--radius) - 4px);
  background: #fff; overflow: hidden; margin-bottom: 12px;
}
.thumb-cycle img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  opacity: 0; transition: opacity 0.5s ease;
}
.thumb-cycle img.active { opacity: 1; }

/* Product grid */
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 24px; }
.section-title h2 { margin: 0; font-size: 26px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 28px; padding-bottom: 56px; }
.product-card { display: flex; flex-direction: column; gap: 12px; }
.product-image {
  width: 100%; aspect-ratio: 1 / 1; border-radius: var(--radius); background: #fff;
  display: flex; align-items: center; justify-content: center; color: var(--muted);
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; overflow: hidden;
}
.product-image img { width: 100%; height: 100%; object-fit: contain; }
.product-name { font-weight: 600; font-size: 15px; }
.product-spec { color: var(--muted); font-size: 12.5px; }
.product-price { color: var(--accent); font-size: 13px; font-weight: 600; }

/* Craft band */
.craft-band { background: var(--panel); padding: 48px 0; margin: 24px 0; border-radius: var(--radius); }
.craft-band .container { display: flex; gap: 56px; align-items: center; flex-wrap: wrap; }
.craft-band p { color: var(--text); max-width: 620px; }
.materials { display: flex; flex-direction: column; gap: 12px; }
.material-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; margin-right: 8px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field label { font-size: 13px; font-weight: 600; }
.field input, .field select, .field textarea {
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 14px; background: #fff; color: var(--text);
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: 1; }
.admin-shell .field input, .admin-shell .field select, .admin-shell .field textarea {
  padding: 5px 2px; border: none; border-bottom: 1px solid var(--border); border-radius: 0;
  background: transparent; color: var(--input-dark);
}
.admin-shell .field input:focus, .admin-shell .field select:focus, .admin-shell .field textarea:focus {
  outline: none; border-bottom-color: var(--accent);
}
.admin-shell .field { margin-bottom: 6px; gap: 2px; }
.admin-shell .field label { font-size: 11px; font-weight: 500; color: var(--label-light); text-transform: uppercase; letter-spacing: 0.02em; }
.admin-shell .field-missing label { color: var(--accent); }
.admin-shell .field-missing input, .admin-shell .field-missing select, .admin-shell .field-missing textarea,
.admin-shell input.field-missing {
  border-bottom-color: var(--accent); background: #fbeaea;
}
.admin-shell .field-missing input::placeholder, .admin-shell .field-missing textarea::placeholder,
.admin-shell input.field-missing::placeholder {
  color: #b98a8a;
}
.form-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px 14px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 14px; }
.mini-table { border-top: 1px solid var(--border); }
.mini-table-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.mini-table-row label {
  flex: 0 0 120px; font-size: 11px; font-weight: 500; color: var(--label-light);
  text-transform: uppercase; letter-spacing: 0.02em; margin: 0;
}
.mini-table-row input, .mini-table-row select {
  flex: 1; border: none; background: transparent; padding: 2px 0; font-size: 13px;
  font-family: inherit; color: var(--input-dark); min-width: 0; text-align: right;
}
.mini-table-row input:focus, .mini-table-row select:focus { outline: none; }
.mini-table-row .feature-name { flex: 0 0 45%; color: var(--label-light); text-transform: uppercase; letter-spacing: 0.02em; font-size: 11px; text-align: left; }
.mini-table-row .feature-value { flex: 1; color: var(--input-dark); font-size: 13px; }
.char-label-row { display: flex; justify-content: space-between; align-items: baseline; }
.char-count { font-size: 10.5px; color: var(--label-light); font-weight: 500; text-transform: none; letter-spacing: normal; }
.seo-score {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
  border-radius: 8px; margin-bottom: 14px; border: 1px solid;
}
.seo-score-value { font-size: 17px; font-weight: 700; }
.seo-score-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.seo-score-poor { background: #fbeaea; border-color: #f0cccc; color: var(--accent-dark); }
.seo-score-fair { background: #fdf1df; border-color: #f2ddb0; color: #92650f; }
.seo-score-good { background: #eaf3ee; border-color: #cfe4d7; color: var(--green); }
.seo-score-excellent { background: #eaf3ee; border-color: var(--green); color: var(--green); }
.seo-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; }
.seo-dot-poor { background: var(--accent-dark); }
.seo-dot-fair { background: #c98a1a; }
.seo-dot-good { background: var(--green); opacity: 0.6; }
.seo-dot-excellent { background: var(--green); }
.field textarea { resize: vertical; }
.form-row { display: flex; gap: 16px; }
.form-row .field { flex: 1; }
form { max-width: 520px; }
form.wide { max-width: none; }
.product-edit-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .product-edit-grid { grid-template-columns: 1fr; } }

/* Alerts */
.alert { padding: 14px 18px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; }
.alert-error { background: #fbeaea; color: var(--accent-dark); border: 1px solid #edcccc; }
.alert-success { background: #eaf3ee; color: var(--green); border: 1px solid #cfe4d7; }

/* Cart & tables */
table { width: 100%; border-collapse: collapse; }
table th, table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.admin-shell table th, .admin-shell table td { padding: 3.5px 10px; font-size: 13px; }
.admin-shell h3 { margin: 11px 0 3px; }
.admin-shell .field { margin-bottom: 9px; }
.tree-table th, .tree-table td { padding: 1.5px 10px; }
.tree-table .tree-parent td:first-child { font-weight: 700; padding-top: 5px; }
.tree-table .tree-child td:first-child { padding-left: 26px; color: var(--muted); font-size: 12.5px; }
.tree-table .tree-branch { color: var(--border); margin-right: 4px; }
.tree-table .drag-handle { color: var(--muted); cursor: grab; width: 28px; }
.tree-table tr:hover .drag-handle { color: var(--text); }
.tree-table tr[draggable="true"] { cursor: default; }
.cat-products .drag-handle { color: var(--muted); cursor: grab; width: 24px; }
.cat-products tr:hover .drag-handle { color: var(--text); }
.cat-products tr[draggable="true"] { cursor: default; }
.cat-header { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.cat-header:hover { opacity: 0.75; }
.cat-chevron { flex: none; color: var(--muted); transition: transform 0.15s ease; }
.cat-header.cat-open .cat-chevron { transform: rotate(90deg); }
.icon-action {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border);
  background: none; color: var(--text); cursor: pointer; vertical-align: middle;
}
.icon-action:hover { background: var(--panel); opacity: 1; }
.icon-action-danger { color: var(--accent); border-color: var(--accent); }
.icon-action-danger:hover { background: #fbeaea; }
.admin-card { background: none; border: 1px solid var(--card-border); border-radius: var(--radius); padding: 14px 16px 18px; margin-bottom: 14px; }
.admin-card h3 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--label-light); }
.qty-input { width: 60px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; }
.cart-summary { max-width: 360px; margin-left: auto; padding: 24px; background: var(--panel); border-radius: var(--radius); }
.cart-summary .row { display: flex; justify-content: space-between; padding: 6px 0; }

/* Badges */
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; }
.badge-toggle { border: none; cursor: pointer; font-family: inherit; }
.badge-toggle:hover { opacity: 0.75; }
.badge-pending { background: #fdf1df; color: #92650f; }
.badge-confirmed { background: #eaf3ee; color: var(--green); }
.badge-shipped { background: #e8eefc; color: #26418f; }
.badge-cancelled { background: #fbeaea; color: var(--accent-dark); }
.badge-sent { background: #eaf3ee; color: var(--green); }
.badge-failed { background: #fbeaea; color: var(--accent-dark); }

/* Stat cards (Email Follow-up dashboard) */
.stat-cards { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px 20px; min-width: 120px; }
.stat-card .num { font-size: 26px; font-weight: 700; line-height: 1.2; }
.stat-card .label { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }

/* Footer */
.site-footer { background: var(--footer-bg); border-top: 1px solid var(--border); padding: 28px 0; margin-top: 32px; }
.site-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 24px; }
.footer-cols { display: flex; gap: 56px; flex-wrap: wrap; }
.footer-col { display: flex; flex-direction: column; gap: 7px; }
.footer-col .title { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.footer-col a { font-size: 13px; }
.footer-note { text-align: right; }
.footer-note .tag { font-size: 13px; font-weight: 600; }
.footer-note .copy { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* Admin */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar { width: 220px; background: #1c1512; color: #f3ede6; padding: 28px 20px; flex-shrink: 0; }
.admin-sidebar .brand { font-weight: 700; margin-bottom: 28px; font-size: 15px; }
.admin-sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.admin-sidebar a { padding: 10px 12px; border-radius: 8px; font-size: 14px; color: #e8ddd2; }
.admin-sidebar a:hover, .admin-sidebar a.active { background: rgba(255,255,255,0.08); opacity: 1; }
.admin-main { flex: 1; padding: 36px 44px; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; margin-bottom: 32px; }
.stat-card { background: var(--panel); border-radius: var(--radius); padding: 20px; }
.stat-card .num { font-size: 28px; font-weight: 700; }
.stat-card .label { font-size: 12.5px; color: var(--muted); }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--panel); }
.primary-badge { display: none; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--green); }
.product-image-item:first-child .primary-badge { display: block; margin-bottom: 2px; }

@media (max-width: 760px) {
  .site-header { flex-wrap: wrap; row-gap: 14px; }
  .header-actions { gap: 12px; }
  .hero { flex-direction: column; padding: 40px 0; }
  .hero h2 { font-size: 38px; }
  .craft-band .container { flex-direction: column; align-items: flex-start; }
  .admin-shell { flex-direction: column; }
  .admin-sidebar { width: auto; }
  .site-footer .container { flex-direction: column; }
  .footer-note { text-align: left; }
}
