/* ============================================================
   Plukpalang Products – Main Stylesheet
   WCAG 2.1 AA compliant
   ============================================================ */

/* ── Google Fonts (Sarabun – excellent Thai readability) ── */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

/* ══════════════════════════════════════════════════════════
   1. CSS Custom Properties (design tokens)
   ══════════════════════════════════════════════════════════ */
:root {
  /* Light theme (default) */
  --color-bg:            #ffffff;
  --color-bg-secondary:  #f5f7fa;
  --color-bg-tertiary:   #e8ecf1;
  --color-text:          #1a1a2e;
  --color-text-muted:    #4a5568;
  --color-primary:       #1a56db;
  --color-primary-hover: #1341a8;
  --color-primary-text:  #ffffff;
  --color-success-bg:    #d1fae5;
  --color-success-text:  #065f46;
  --color-error-bg:      #fee2e2;
  --color-error-text:    #991b1b;
  --color-warning-bg:    #fef3c7;
  --color-warning-text:  #92400e;
  --color-border:        #cbd5e0;
  --color-card-bg:       #ffffff;
  --color-card-shadow:   rgba(0,0,0,.10);
  --color-overlay:       rgba(0,0,0,.55);
  --color-focus:         #1a56db;
  --color-badge-hidden-bg:   #fef3c7;
  --color-badge-hidden-text: #92400e;
  --color-badge-vis-bg:      #d1fae5;
  --color-badge-vis-text:    #065f46;

  /* Font scale – medium (default) */
  --fs-xs:   0.75rem;
  --fs-sm:   0.875rem;
  --fs-base: 1rem;
  --fs-md:   1.125rem;
  --fs-lg:   1.25rem;
  --fs-xl:   1.5rem;
  --fs-2xl:  2rem;

  /* Spacing */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-12: 3rem;

  /* Borders */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-full: 9999px;

  /* Transitions */
  --transition: 200ms ease;
}

/* ── Dark theme ── */
[data-theme="dark"] {
  --color-bg:            #0f0f1a;
  --color-bg-secondary:  #1a1a2e;
  --color-bg-tertiary:   #252540;
  --color-text:          #e2e8f0;
  --color-text-muted:    #94a3b8;
  --color-primary:       #93c5fd;
  --color-primary-hover: #bfdbfe;
  --color-primary-text:  #0f172a;
  --color-success-bg:    #064e3b;
  --color-success-text:  #a7f3d0;
  --color-error-bg:      #7f1d1d;
  --color-error-text:    #fca5a5;
  --color-warning-bg:    #78350f;
  --color-warning-text:  #fde68a;
  --color-border:        #374151;
  --color-card-bg:       #1a1a2e;
  --color-card-shadow:   rgba(0,0,0,.35);
  --color-overlay:       rgba(0,0,0,.70);
  --color-focus:         #93c5fd;
  --color-badge-hidden-bg:   #78350f;
  --color-badge-hidden-text: #fde68a;
  --color-badge-vis-bg:      #064e3b;
  --color-badge-vis-text:    #a7f3d0;
}

/* ── Font-size scale overrides ── */
[data-font-size="small"] {
  --fs-xs:   0.6875rem;
  --fs-sm:   0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md:   1rem;
  --fs-lg:   1.125rem;
  --fs-xl:   1.375rem;
  --fs-2xl:  1.75rem;
}

[data-font-size="large"] {
  --fs-xs:   0.875rem;
  --fs-sm:   1rem;
  --fs-base: 1.1875rem;
  --fs-md:   1.375rem;
  --fs-lg:   1.5rem;
  --fs-xl:   1.875rem;
  --fs-2xl:  2.5rem;
}

/* ══════════════════════════════════════════════════════════
   2. Base reset & globals
   ══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-family: 'Sarabun', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  scroll-behavior: smooth;
}

body { min-height: 100vh; display: flex; flex-direction: column; }

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

/* ── Visible focus indicator (WCAG 2.4.7) ── */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* ══════════════════════════════════════════════════════════
   3. Skip navigation link (WCAG 2.4.1)
   ══════════════════════════════════════════════════════════ */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--sp-4);
  z-index: 9999;
  padding: var(--sp-3) var(--sp-6);
  background: var(--color-primary);
  color: var(--color-primary-text);
  font-weight: 600;
  font-size: var(--fs-base);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: top var(--transition);
}
.skip-link:focus { top: var(--sp-4); }

/* ══════════════════════════════════════════════════════════
   4. Notifications / live region
   ══════════════════════════════════════════════════════════ */
#notifications {
  position: fixed;
  top: var(--sp-4);
  right: var(--sp-4);
  z-index: 8000;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-width: 24rem;
  pointer-events: none;
}

.notification {
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  font-weight: 500;
  box-shadow: 0 4px 12px var(--color-card-shadow);
  animation: slideIn .25s ease forwards;
  pointer-events: auto;
}
.notification--success { background: var(--color-success-bg); color: var(--color-success-text); }
.notification--error   { background: var(--color-error-bg);   color: var(--color-error-text); }
.notification--info    { background: var(--color-bg-secondary); color: var(--color-text); border: 1px solid var(--color-border); }

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

/* ══════════════════════════════════════════════════════════
   5. Header
   ══════════════════════════════════════════════════════════ */
.site-header {
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
  padding: var(--sp-3) var(--sp-6);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.site-logo {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
  flex-shrink: 0;
}
.site-logo:hover { text-decoration: underline; }

.header-nav { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin-left: auto; }

/* ── Header control groups ── */
.control-group {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 0 var(--sp-2);
  border-left: 1px solid var(--color-border);
}
.control-group:first-child { border-left: none; padding-left: 0; }

/* ══════════════════════════════════════════════════════════
   6. Buttons
   ══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-5);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.4;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
  min-height: 44px; /* WCAG 2.5.5 touch target */
  min-width: 44px;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn--primary {
  background: var(--color-primary);
  color: var(--color-primary-text);
  border-color: var(--color-primary);
}
.btn--primary:hover:not(:disabled) { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }

.btn--secondary {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn--secondary:hover:not(:disabled) { background: var(--color-bg-tertiary); }

.btn--ghost {
  background: transparent;
  color: var(--color-text);
  border-color: transparent;
  font-weight: 500;
  padding: var(--sp-1) var(--sp-3);
  min-height: 36px;
}
.btn--ghost:hover:not(:disabled) { background: var(--color-bg-tertiary); }
.btn--ghost[aria-pressed="true"] {
  background: var(--color-primary);
  color: var(--color-primary-text);
  border-color: var(--color-primary);
}

.btn--danger  { background: var(--color-error-bg);   color: var(--color-error-text);   border-color: var(--color-error-text); }
.btn--danger:hover:not(:disabled)  { filter: brightness(.92); }
.btn--success { background: var(--color-success-bg); color: var(--color-success-text); border-color: var(--color-success-text); }
.btn--success:hover:not(:disabled) { filter: brightness(.92); }
.btn--warning { background: var(--color-warning-bg); color: var(--color-warning-text); border-color: var(--color-warning-text); }
.btn--warning:hover:not(:disabled) { filter: brightness(.92); }

.btn--full { width: 100%; }
.btn--sm   { padding: var(--sp-1) var(--sp-3); font-size: var(--fs-xs); min-height: 36px; }
.btn--icon { padding: var(--sp-1) var(--sp-2); font-size: var(--fs-xs); min-height: 36px; min-width: 36px; font-weight: 700; }

/* ══════════════════════════════════════════════════════════
   7. Forms
   ══════════════════════════════════════════════════════════ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin-bottom: var(--sp-5);
}

label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-text);
}
label .required {
  color: var(--color-error-text);
  margin-left: var(--sp-1);
  aria-hidden: true;
}

input[type="text"],
input[type="password"],
input[type="email"],
textarea,
select {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  font-family: inherit;
  font-size: var(--fs-base);
  color: var(--color-text);
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition);
}
input[type="text"]:hover,
input[type="password"]:hover,
textarea:hover,
select:hover { border-color: var(--color-primary); }

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-focus);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, .25);
}

textarea { resize: vertical; min-height: 90px; }

.form-error {
  font-size: var(--fs-xs);
  color: var(--color-error-text);
  font-weight: 500;
  min-height: 1.2em;
}
.form-error--general {
  padding: var(--sp-3) var(--sp-4);
  background: var(--color-error-bg);
  border-radius: var(--radius-md);
  margin-bottom: var(--sp-4);
  display: none;
}
.form-error--general:not(:empty) { display: block; }

/* File input */
.file-input-wrapper { display: flex; flex-direction: column; gap: var(--sp-2); }
.file-input-label {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: var(--color-bg-secondary);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  transition: border-color var(--transition), background var(--transition);
}
.file-input-label:hover { border-color: var(--color-primary); background: var(--color-bg-tertiary); }
input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}
.file-name { font-size: var(--fs-xs); color: var(--color-text-muted); }

/* Image preview */
.image-preview {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 2px solid var(--color-border);
  background: var(--color-bg-secondary);
}
.image-preview-placeholder {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-md);
  border: 2px dashed var(--color-border);
  background: var(--color-bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
  text-align: center;
  padding: var(--sp-2);
}

/* ══════════════════════════════════════════════════════════
   8. Login page
   ══════════════════════════════════════════════════════════ */
.login-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-8) var(--sp-4);
  background: var(--color-bg-secondary);
}

.login-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-8);
  width: 100%;
  max-width: 420px;
  box-shadow: 0 4px 24px var(--color-card-shadow);
}

.login-card h1 {
  font-size: var(--fs-xl);
  font-weight: 700;
  text-align: center;
  margin-bottom: var(--sp-6);
  color: var(--color-text);
}

.login-footer {
  text-align: center;
  margin-top: var(--sp-5);
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}
.login-footer a { color: var(--color-primary); font-weight: 500; }

/* ══════════════════════════════════════════════════════════
   9. Product Grid (customer view)
   ══════════════════════════════════════════════════════════ */
.page-main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: var(--sp-8) var(--sp-6);
}

.page-title {
  font-size: var(--fs-2xl);
  font-weight: 700;
  margin-bottom: var(--sp-6);
  color: var(--color-text);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-6);
}

.category-section {
  margin-bottom: var(--sp-8);
}
.category-section__title {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-2);
  border-bottom: 2px solid var(--color-border);
}

.product-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 2px 8px var(--color-card-shadow);
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition), transform var(--transition);
}
.product-card:hover { box-shadow: 0 6px 20px var(--color-card-shadow); transform: translateY(-2px); }

.product-card__image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-bottom: 1px solid var(--color-border);
}
.product-card__image-placeholder {
  width: 100%;
  height: 200px;
  background: var(--color-bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
  border-bottom: 1px solid var(--color-border);
}
.product-card__image-placeholder::after { content: "🖼"; font-size: 2.5rem; }

.product-card__content { padding: var(--sp-5); flex: 1; display: flex; flex-direction: column; gap: var(--sp-2); }
.product-card__name { font-size: var(--fs-md); font-weight: 700; color: var(--color-text); line-height: 1.3; }
.product-card__description { font-size: var(--fs-sm); color: var(--color-text-muted); line-height: 1.6; flex: 1; }
.product-card__price {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--color-primary);
  margin-top: auto;
}

/* Product card gallery (multiple images) */
.product-card__gallery {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
  border-bottom: 1px solid var(--color-border);
}
.gallery-slides {
  width: 100%;
  height: 100%;
}
.gallery-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.gallery-slide--active { opacity: 1; }

.gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,.45);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  width: 2rem;
  height: 2rem;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}
.gallery-arrow:hover { background: rgba(0,0,0,.65); }
.gallery-arrow--prev { left: var(--sp-2); }
.gallery-arrow--next { right: var(--sp-2); }

.gallery-dots {
  position: absolute;
  bottom: var(--sp-2);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--sp-1);
  z-index: 2;
}
.gallery-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,.6);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background var(--transition);
}
.gallery-dot--active,
.gallery-dot:hover { background: #fff; }

/* Image gallery editor (manage form) */
.image-gallery-editor {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  min-height: 2rem;
  margin-bottom: var(--sp-3);
}
.image-gallery-editor__empty {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  padding: var(--sp-2) 0;
}
.image-gallery-editor__item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--color-border);
}
.image-gallery-editor__item--pending { opacity: 0.6; }
.image-gallery-editor__thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
}
.image-gallery-editor__delete {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  padding: 0;
  font-size: 0.7rem;
  line-height: 1;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-gallery-editor__badge {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: 0.6rem;
  text-align: center;
  padding: 2px;
}

/* ══════════════════════════════════════════════════════════
   10. Manage page — tabs + table
   ══════════════════════════════════════════════════════════ */

/* Tab navigation */
.tab-nav {
  display: flex;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: var(--sp-6);
  gap: 0;
}
.tab-btn {
  padding: var(--sp-3) var(--sp-5);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  background: none;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: color var(--transition), border-color var(--transition);
}
.tab-btn:hover { color: var(--color-text); }
.tab-btn[aria-selected="true"] {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}
.manage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.product-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.product-table th,
.product-table td {
  padding: var(--sp-3) var(--sp-5);
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--color-border);
}
.product-table th {
  background: var(--color-bg-secondary);
  font-weight: 700;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-text-muted);
}
.product-table tr:last-child td { border-bottom: none; }
.product-table tbody tr:hover { background: var(--color-bg-secondary); }
.product-table .col-name { min-width: 120px; max-width: 180px; }
.product-table .col-desc { min-width: 140px; max-width: 240px; white-space: pre-wrap; word-break: break-word; color: var(--color-text-muted); font-size: var(--fs-xs); vertical-align: top; padding-top: var(--sp-4); }
.table-cell--center { text-align: center; padding: 2rem; color: var(--color-text-muted); }

.product-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}
.product-thumb-placeholder {
  width: 56px;
  height: 56px;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}
.product-thumb-placeholder::after { content: "🖼"; }

.actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* ── Status badge ── */
.status-badge {
  display: inline-block;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
}
.status-badge--visible { background: var(--color-badge-vis-bg);    color: var(--color-badge-vis-text); }
.status-badge--hidden  { background: var(--color-badge-hidden-bg); color: var(--color-badge-hidden-text); }

/* ══════════════════════════════════════════════════════════
   11. Modal / Dialog
   ══════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  animation: fadeIn .2s ease;
}
.modal-backdrop[hidden] { display: none; }

.modal {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px var(--color-card-shadow);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn .2s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-card-bg);
  z-index: 1;
}
.modal-title { font-size: var(--fs-lg); font-weight: 700; }

.modal-body { padding: var(--sp-6); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.close-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--sp-2);
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  font-size: var(--fs-md);
  line-height: 1;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.close-btn:hover { color: var(--color-text); background: var(--color-bg-tertiary); }

/* ── Confirm dialog ── */
.confirm-dialog {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px var(--color-card-shadow);
  width: 100%;
  max-width: 380px;
  padding: var(--sp-6);
  text-align: center;
  animation: scaleIn .2s ease;
}
.confirm-dialog h2 { font-size: var(--fs-md); margin-bottom: var(--sp-4); }
.confirm-dialog__actions { display: flex; gap: var(--sp-3); justify-content: center; margin-top: var(--sp-5); }

@keyframes fadeIn  { from { opacity:0; } to { opacity:1; } }
@keyframes scaleIn { from { opacity:0; transform:scale(.96); } to { opacity:1; transform:scale(1); } }

/* ══════════════════════════════════════════════════════════
   12. Loading / empty states
   ══════════════════════════════════════════════════════════ */
.state-message {
  text-align: center;
  padding: var(--sp-12) var(--sp-6);
  color: var(--color-text-muted);
  font-size: var(--fs-md);
}
.state-message[hidden] { display: none; }

.spinner {
  display: inline-block;
  width: 1.5em;
  height: 1.5em;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
  margin-right: var(--sp-2);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════
   13. Footer
   ══════════════════════════════════════════════════════════ */
.site-footer {
  background: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border);
  padding: var(--sp-4) var(--sp-6);
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
}

/* ══════════════════════════════════════════════════════════
   14. Form two-column layout (bilingual fields)
   ══════════════════════════════════════════════════════════ */
.form-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
@media (max-width: 520px) { .form-cols { grid-template-columns: 1fr; } }

.form-section-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--sp-2);
  margin: var(--sp-5) 0 var(--sp-3);
}

/* ══════════════════════════════════════════════════════════
   15. Responsive
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .header-inner { gap: var(--sp-2); }
  .page-main { padding: var(--sp-5) var(--sp-4); }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--sp-4); }
  .manage-header { flex-direction: column; align-items: flex-start; }
  .product-table th:nth-child(1),
  .product-table td:nth-child(1) { display: none; } /* hide image col on small screens */
  .modal-body { padding: var(--sp-4); }
}

@media (max-width: 480px) {
  .login-card { padding: var(--sp-5); }
  .control-group { border-left: none; padding-left: 0; }
}

/* ══════════════════════════════════════════════════════════
   16. Reduced motion (WCAG 2.3.3)
   ══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
  .product-card:hover { transform: none; }
  html { scroll-behavior: auto; }
}

/* ══════════════════════════════════════════════════════════
   17. Print
   ══════════════════════════════════════════════════════════ */
@media print {
  .site-header, .site-footer, .btn, #notifications { display: none !important; }
  .page-main { max-width: 100%; padding: 0; }
  .product-card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
}
