/* PREMIUM ZELLIJ CATALOG - v33 */
html, body {
  overflow-x: hidden;
  width: 100%;
}

:root {
  --primary: #1a1a1a;
  --accent: #d4a574;
  --accent-light: #e8c9a8;
  --bg: #f8f6f3;
  --card-bg: #ffffff;
  --text: #2c2c2c;
  --text-light: #6b6b6b;
  --border: #e5e5e5;
  --success: #10b981;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.15);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: "Playfair Display", Georgia, serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* GATE / LOGIN */
.gate-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

.gate-box {
  background: white;
  padding: 48px 40px;
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  text-align: center;
  max-width: 420px;
  width: 100%;
}

.gate-box h1 {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 8px;
}

.gate-box p {
  color: var(--text-light);
  font-size: 1.05rem;
  margin-bottom: 24px;
}

.loading {
  color: var(--text-light);
  font-size: 0.95rem;
  margin-top: 20px;
}

/* LINKS */
a {
  color: var(--accent);
  text-decoration: none;
  transition: all 0.2s;
}

a:hover {
  color: var(--primary);
  text-decoration: underline;
}

a:active {
  opacity: 0.7;
}

/* HEADER */
.app-header {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand h1 {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.badge {
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent-light) 100%
  );
  color: white;
  font-size: 0.75rem;
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

#currency-select {
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 8px;
  background: white;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

#currency-select:hover {
  border-color: var(--accent);
}

#currency-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1);
}

.logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-light);
  transition: all 0.2s;
}

.logout-btn:hover {
  background: #f5f5f5;
  color: var(--text);
  border-color: var(--text-light);
}

.logout-btn:active {
  transform: scale(0.95);
}

.logout-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1);
  border-color: var(--accent);
}

.logout-btn svg {
  display: block;
}

/* TABS */
.tabs-container {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  display: flex;
  gap: 32px;
}

.tab-btn {
  background: none;
  border: none;
  padding: 16px 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.3s;
  position: relative;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--accent);
}

.tab-btn:focus {
  outline: none;
  background: rgba(212, 165, 116, 0.05);
}

.tab-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* PRODUCT GRID */
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding: 32px;
  max-width: 1400px;
  margin: 0 auto;
}

/* PRODUCT CARD */
.product-card {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  border: 2px solid transparent;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.product-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    var(--accent-light) 100%
  );
  opacity: 0;
  transition: opacity 0.3s;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-light);
}

.product-card:hover::before {
  opacity: 1;
}

.card-header {
  padding: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.3;
}

.card-code {
  font-size: 0.85rem;
  color: var(--text-light);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 500;
}

.size-check {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
  transition: all 0.2s;
  position: relative;
}

.size-check.checked {
  background: var(--accent);
  border-color: var(--accent);
}

.size-check.checked::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
}

.card-body {
  padding: 20px;
}

/* SIZES TABLE */
.sizes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.sizes-table thead {
  border-bottom: 2px solid var(--border);
}

.sizes-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text);
  padding: 8px 4px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.size-header {
  color: var(--text-light);
}

.price-header {
  text-align: right;
}

.size-row {
  border-bottom: 1px solid #f5f5f5;
  transition: background 0.2s;
  cursor: pointer;
  outline: none;
}

.size-row:hover {
  background: var(--bg);
}

.size-row.selected {
  background: rgba(212, 159, 116, 0.1);
}

.size-row:focus {
  background: rgba(212, 165, 116, 0.08);
  outline: 2px solid var(--accent-light);
  outline-offset: -2px;
}

.size-row:active {
  background: rgba(212, 165, 116, 0.15);
}

.size-row.selected:hover {
  background: rgba(212, 159, 116, 0.15);
}

.size-row.selected:focus {
  background: rgba(212, 159, 116, 0.18);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.size-row:last-child {
  border-bottom: none;
}

.size-label {
  padding: 10px 4px;
  color: var(--text);
  font-weight: 500;
}

.price-cell {
  padding: 10px 4px;
  text-align: right;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

/* FLOATING ACTION BAR */
.fab-bar {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  padding: 20px 32px;
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 32px;
  transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  max-width: 90vw;
}

.fab-bar.visible {
  bottom: 32px;
}

.fab-info {
  flex: 1;
}

.fab-count {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.fab-hint {
  font-size: 0.85rem;
  opacity: 0.8;
}

.fab-actions {
  display: flex;
  gap: 12px;
}

.fab-btn {
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.fab-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.fab-btn.secondary {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

.fab-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.25);
}

.fab-btn.primary {
  background: var(--accent);
  color: white;
}

.fab-btn.primary:hover {
  background: var(--accent-light);
  transform: scale(1.05);
}

.fab-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.fab-btn:active {
  transform: scale(0.98);
}

/* FOOTER */
footer {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
  font-size: 0.9rem;
}

/* ===== ADMIN PANEL STYLES ===== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: var(--font-sans);
  transition: all 0.2s;
  background: white;
  color: var(--text);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1);
}

.form-group input:hover:not(:focus),
.form-group select:hover:not(:focus) {
  border-color: var(--accent-light);
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent-light) 100%
  );
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-primary-small {
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent-light) 100%
  );
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary-small:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-primary-small:active {
  transform: translateY(0);
}

.btn-primary:focus,
.btn-primary-small:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.3);
}

.admin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px;
}

.admin-header {
  margin-bottom: 32px;
}

.admin-header h2 {
  font-size: 2rem;
  color: var(--primary);
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
  border-bottom: 2px solid var(--border);
}

.admin-tab {
  padding: 12px 24px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-light);
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  user-select: none;
}

.admin-tab:hover {
  color: var(--text);
}

.admin-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.admin-tab:focus {
  outline: none;
  background: rgba(212, 165, 116, 0.05);
}

.admin-tab:active {
  transform: scale(0.98);
}

.admin-body {
  background: white;
  padding: 32px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

/* CHECKBOX GROUPS */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: color 0.2s;
}

.checkbox-group label:hover {
  color: var(--accent);
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
}

.error {
  color: #dc2626;
  font-size: 0.9rem;
}

/* ADMIN TABLES */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

table thead {
  background: var(--bg);
  border-bottom: 2px solid var(--border);
}

table th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

table td {
  padding: 16px;
  border-bottom: 1px solid #f5f5f5;
}

table tr:hover {
  background: var(--bg);
}

/* BADGES */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-green {
  background: #d1fae5;
  color: #065f46;
}

.badge-red {
  background: #fee2e2;
  color: #991b1b;
}

/* ADMIN BUTTONS */
.btn-micro-danger {
  background: transparent;
  border: 1px solid #dc2626;
  color: #dc2626;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-micro-danger:hover {
  background: #dc2626;
  color: white;
}

.btn-micro-danger:active {
  transform: scale(0.95);
}

.btn-micro-danger:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
}

.btn-micro-primary {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-micro-primary:hover {
  background: var(--accent);
  color: white;
}

.btn-micro-primary:active {
  transform: scale(0.95);
}

.btn-micro-primary:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.2);
}

/* SPL CARD REFINEMENTS */
.spl-card {
  border: 1px solid #e5e5e5; /* border-neutral-200 */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); /* shadow-sm */
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.spl-card:hover {
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06); /* shadow-md */
}

/* Force 1:1 Aspect Ratio for Visual Container */
.spl-visual-container {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #ffffff;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0; /* No padding per reference */
  margin: 0;
}

.spl-mask {
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform 0.5s ease;
}

.spl-card:hover .spl-mask {
  transform: scale(1.05);
}

/* Clip Paths */
.hex-mask {
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.sq-mask {
  clip-path: none;
}

.spl-mask img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Gloss Overlay */
.spl-gloss-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top right,
    rgba(0, 0, 0, 0.05),
    rgba(255, 255, 255, 0.1)
  );
  pointer-events: none;
  mix-blend-mode: overlay;
}

/* Info Section Padding */
.spl-card-body {
  padding: 1.25rem; /* p-5 */
  display: flex;
  flex-direction: column;
  gap: 0.75rem; /* gap-3 */
}

/* Badges */
.spl-badges-row {
  display: flex;
  gap: 0.5rem; /* gap-2 */
  margin-bottom: 0.25rem;
}

.spl-badge {
  font-size: 10px;
  padding: 2px 8px; /* py-1 px-2 */
  border-radius: 4px; /* rounded */
  border: 1px solid;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.spl-badge.active {
  background-color: #171717; /* bg-neutral-900 */
  color: white;
  border-color: #171717;
}

.spl-badge.inactive {
  color: #a3a3a3; /* text-neutral-400 */
  border-color: #f5f5f5; /* border-neutral-100 */
  background: transparent;
}

/* Color Dot */
.spl-dot-group {
  display: flex;
  gap: 4px;
}
.spl-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 9999px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Code Tag */
.spl-code-tag {
  font-size: 0.75rem; /* text-xs */
  font-family: monospace;
  font-weight: 600;
  color: #a3a3a3; /* text-neutral-400 */
  display: block;
  margin-bottom: 4px;
}

/* Divider */
.spl-divider {
  height: 1px;
  background-color: #f5f5f5; /* bg-neutral-100 */
  width: 100%;
  margin: 4px 0;
}

/* SPL VARIANT GRID (MIL Style) */
.spl-grid {
  display: grid;
  /* Increase min size slightly to prevent squishing text, but keep 2 columns on mobile */
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.spl-variant {
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  color: #111827; /* Always dark text by default */
}

.spl-variant:hover {
  border-color: #a3a3a3;
  background: #f9fafb;
}

/* SELECTED STATE - High Contrast: Black Border, Light Background */
.spl-variant.selected {
  background: #fff; /* Keep white background for readability */
  color: #000; /* Keep black text */
  border: 2px solid #000; /* Thick black border */
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.spl-variant-info {
  display: flex;
  flex-direction: column;
}

.spl-variant-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: inherit;
}

.spl-variant-price {
  font-size: 0.85rem;
  color: inherit;
  opacity: 0.8;
}

.spl-check {
  width: 20px;
  height: 20px;
  border: 2px solid #d4c5b9; /* Light clay border */
  border-radius: 6px; /* More rounded like reference */
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: white;
  transition: all 0.2s;
  position: relative;
}

.spl-check::after {
  content: "✓";
  font-size: 14px;
  font-weight: bold;
  color: transparent;
  transition: all 0.2s;
}

.spl-variant.selected .spl-check {
  background: linear-gradient(
    135deg,
    #c9a87c 0%,
    #a68b68 100%
  ); /* Clay gradient */
  border-color: #a68b68;
}

.spl-variant.selected .spl-check::after {
  color: white; /* White checkmark */
}

/* SPL Shapes */
.spl-mask {
  width: 100%;
  height: 100%;
  transition: clip-path 0.3s ease;
  overflow: hidden;
}

.hex-mask {
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.sq-mask {
  clip-path: none; /* or polygon(0 0, 100% 0, 100% 100%, 0 100%) for smoother transition? */
  /* Use polygon for transition consistency if browser supports: */
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

/* MODAL */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-xl);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.2s;
}

.modal.visible .modal-content {
  transform: scale(1);
}

/* --- SPL STYLES (Special Tiles) --- */

/* Grid Mode for SPL: Single Column for Wide Rows */
/* Grid Mode for SPL: Single Column Mobile, 2 Columns Desktop */
.grid-container.spl-mode {
  display: grid; /* Ensure grid display */
  grid-template-columns: 1fr;
  gap: 1rem;
  max-width: 1400px; /* Wider for 2 columns */
  margin: 0 auto;
}

@media (min-width: 800px) {
  /* Aggressively lowered to 800px to ensure desktop 2-col */
  .grid-container.spl-mode {
    grid-template-columns: repeat(2, 1fr) !important; /* Force 2-col */
  }
}

/* SPL Card Layout */
.spl-card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 24px;
}

@media (min-width: 768px) {
  .spl-card,
  .mil-card {
    flex-direction: row !important; /* Force horizontal on desktop */
    align-items: flex-start;
  }
}

/* 5x5 CM Size Differentiation */
.is-5x5 .spl-mask,
.is-5x5 .spl-img {
  transform: scale(0.7);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.is-5x5 .spl-visual-container:hover .spl-mask,
.is-5x5.spl-visual:hover img {
  transform: scale(0.75) rotate(1deg) !important;
}

/* Visual Section */
.spl-visual,
.mil-visual {
  width: 100%; /* Full width on mobile */
  height: auto;
  aspect-ratio: 1; /* Keep square */
  max-width: 100%; /* Allow full width */
  flex-shrink: 0;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border);
  margin: 0 auto;
}

@media (min-width: 768px) {
  .spl-visual-container,
  .spl-visual,
  .mil-visual {
    margin: 0;
    width: 130px !important;
    height: 130px !important;
    max-width: 130px !important;
    min-height: 130px !important;
    padding: 10px !important;
    flex-shrink: 0;
  }

  .spl-card,
  .mil-card {
    flex-direction: row !important;
    align-items: flex-start;
  }

  .spl-content,
  .mil-content {
    border-top: none !important;
    border-left: 1px solid var(--border) !important;
    padding: 20px !important;
  }
}

.spl-img,
.mil-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* image-rendering: pixelated; Removed for smoother look */
}

.spl-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.3) 0%,
    rgba(0, 0, 0, 0.05) 100%
  );
  pointer-events: none;
  mix-blend-mode: overlay;
}

/* --- MIL Collection Specific Styles (React Match) --- */
.mil-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 0 1rem;
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

@media (min-width: 768px) {
  .mil-controls {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0;
  }
}

.mil-header-group h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--text);
}

.mil-header-group p {
  color: var(--text-light);
  font-size: 0.95rem;
}

.mil-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.btn-remix {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #171717; /* neutral-900 */
  color: white;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn-remix:hover {
  background: #262626; /* neutral-800 */
}

.btn-remix:disabled {
  opacity: 0.7;
  cursor: wait;
}

.mil-search-box {
  position: relative;
  max-width: 100%;
}
.mil-search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
.mil-search-input:focus {
  border-color: #171717;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}
.mil-search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #a3a3a3;
  pointer-events: none;
}

/* MIL Grid Layout - Keeping basics but ensuring List View compatibility */
/* MIL Grid Layout */
.mil-grid-container {
  display: grid; /* Changed from flex column to grid for 2-col support */
  grid-template-columns: 1fr;
  gap: 1rem;
  width: 100%;
  max-width: 1400px; /* Wider for 2 columns */
  margin: 0 auto;
}

@media (min-width: 800px) {
  /* Aggressively lowered to 800px */
  .mil-grid-container {
    grid-template-columns: repeat(2, 1fr) !important; /* Force 2-col */
  }
}

/* MIL Card Style - List View (Matching SPL) */
.mil-card {
  display: flex;
  flex-direction: column; /* Mobile first */
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
  padding: 24px; /* MATCH SPL PADDING */
  gap: 24px; /* MATCH SPL GAP */
}

@media (min-width: 768px) {
  .mil-card {
    flex-direction: row;
    align-items: flex-start; /* Match SPL */
  }
}

.mil-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 600px) {
  /* Mobile adjustments if needed, but shared properties should handle it */
  .mil-visual {
    margin-right: 0;
    margin-bottom: 1rem;
  }
}

.mil-content {
  padding: 1.25rem !important; /* p-5 */
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mil-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center; /* Changed from start to center */
}

.mil-code {
  font-family: monospace;
  font-size: 0.75rem; /* text-xs */
  font-weight: 600;
  color: #a3a3a3;
  display: block;
  margin-bottom: 0.25rem;
}

.mil-title {
  font-weight: 700;
  font-size: 1.125rem; /* text-lg */
  color: #171717; /* neutral-800 */
  margin: 0;
}

.mil-color-dot {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); /* shadow-sm */
}

.mil-divider {
  height: 1px;
  background: #f5f5f5; /* neutral-100 */
  margin: 0.25rem 0;
}

.mil-price-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  font-size: 0.875rem; /* text-sm */
}

.mil-price-box {
  background: #fafafa; /* neutral-50 */
  padding: 0.5rem;
  border-radius: 8px; /* rounded-lg */
  border: 1px solid #f5f5f5; /* neutral-100 */
  display: flex;
  flex-direction: column;
}

.mil-price-label {
  font-size: 0.75rem; /* text-xs */
  color: #a3a3a3; /* neutral-400 */
  font-weight: 500;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.mil-price-value {
  font-weight: 700;
  color: #171717; /* neutral-900 */
}

.mil-select {
  margin-top: 0.5rem;
}

/* Override checkmark for MIL card context if needed */
.mil-card .custom-checkbox {
  width: 100%;
  justify-content: center;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all 0.2s;
}

.mil-card .custom-checkbox:hover {
  background: #f9f9f9;
}

.mil-card .custom-checkbox input:checked ~ .checkmark {
  background-color: #171717;
  border-color: #171717;
}

/* Content Section */
.spl-content,
.mil-content {
  flex-grow: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: center;
  min-height: 130px;
}

/* Header */
.spl-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

@media (min-width: 640px) {
  .spl-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.spl-code {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  display: block;
}

.spl-colors {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}

.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  display: inline-block;
}

/* Variant Grid */
.spl-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 640px) {
  .spl-grid {
    /* Auto-fit based on available width to prevent cramping */
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

/* Variant Item */
.spl-variant {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fcfcfc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.2s;
  gap: 8px; /* Ensure space between code and price */
}

.spl-variant:hover {
  background: white;
  border-color: #d1d5db;
  transform: translateY(-1px);
}

.spl-variant.selected {
  background: rgba(212, 165, 116, 0.1);
  border-color: var(--accent);
}

.spl-v-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spl-code {
  font-family: monospace;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-light);
}

.spl-variant:hover .spl-code {
  color: var(--text);
}

.spl-v-price {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap; /* Prevent currency symbol from wrapping */
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--text-light);
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.btn-secondary {
  background: white;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--bg);
  border-color: var(--text-light);
}

.btn-secondary:active {
  transform: scale(0.98);
}

.btn-secondary:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

/* UNIVERSAL PAGINATION */
.pagination-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 40px 20px;
  flex-wrap: wrap;
  font-size: 0.95rem;
  color: var(--text);
  width: 100%;
}

.pagination-bar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  min-width: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: white;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--font-sans);
  box-shadow: var(--shadow-sm);
}

.pagination-bar button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.pagination-bar button:active:not(:disabled) {
  transform: translateY(0);
}

.pagination-bar button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f9fafb;
  border-color: #f3f4f6;
  box-shadow: none;
  color: #9ca3af;
}

.pagination-bar button .pg-arrow {
  font-size: 1.2rem;
  line-height: 1;
  margin-top: -2px; /* Visual alignment */
}

/* Adjust spacing for text + arrow combinations */
.pagination-bar button .pg-label + .pg-arrow {
  margin-left: 8px;
}

.pagination-bar button .pg-arrow + .pg-label {
  margin-right: 8px; /* For potential future use if arrow is on left */
}

/* Page Info Badge */
.pagination-bar .page-info {
  margin: 0 12px;
  font-weight: 500;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.pagination-bar .page-info strong {
  color: var(--primary);
  font-weight: 600;
}

.pagination-bar .items-count {
  color: #9ca3af;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
  font-size: 0.85rem;
}

@media (max-width: 600px) {
  .pagination-bar {
    gap: 8px;
    padding: 24px 12px;
  }
  
  .pagination-bar button {
    height: 40px;
    min-width: 40px;
    padding: 0 12px;
  }

  .pagination-bar .pg-label {
    display: none; 
  }
  
  .pagination-bar button .pg-arrow {
    display: inline-block;
    margin: 0;
  }
  
  .pagination-bar .items-count {
    display: none; 
  }

  .pagination-bar .page-info {
    font-size: 0.85rem;
    padding: 6px 12px;
    margin: 0 4px;
  }
}

/* COLLECTION CONTROLS (Search + Filters + Actions) */
.collection-controls {
  display: flex;
  gap: 20px;
  padding: 32px 32px 16px 32px; /* Top, Right, Bottom, Left */
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
}

.collection-controls .search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 350px;
}

.collection-controls .search-input-wrapper svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #999;
}

.collection-controls input[type="text"] {
  padding-left: 36px;
  width: 100%;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #e5e5e5;
  font-size: 14px;
  transition: all 0.2s;
}

.collection-controls input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1);
}

/* UTILITIES */
.hidden {
  display: none !important;
}

/* =========================================
   MOBILE RESPONSIVENESS (Max-Width: 768px)
   ========================================= */
@media (max-width: 768px) {
  /* GLOBAL ADJUSTMENTS */
  html, body {
    overflow-x: hidden;
    position: relative;
  }
  
  body {
    padding: 0; /* Removed explicit padding to prevent overflow */
  }

  .gate-container {
    padding: 20px;
  }

  .gate-box {
    padding: 24px;
    width: 100%;
    max-width: 100%;
  }

  /* HEADER & NAVIGATION */
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
  }

  .controls {
    width: 100%;
    justify-content: space-between;
  }

  .tabs-container {
    flex-direction: row;
    flex-wrap: wrap; /* Allow wrapping */
    width: 100%;
    gap: 0; /* Remove gap, handle via width/padding */
    overflow-x: visible; /* No scroll */
    justify-content: space-between;
    padding: 0;
    border-bottom: 1px solid var(--border);
  }

  .tab-btn {
    width: 50%; /* 2 per row */
    white-space: normal; /* Allow text wrap if needed */
    text-align: center;
    padding: 12px 4px;
    border-bottom: 3px solid transparent;
    border-right: 1px solid #f0f0f0; /* Separator */
    border-bottom: 1px solid #f0f0f0; /* Separator */
    font-size: 0.85rem;
  }
  .tab-btn:nth-child(2n) {
    border-right: none;
  }

  /* CATALOG GRID */
  .grid-container {
    grid-template-columns: 1fr;
    /* Single column on mobile for standard items */
    gap: 24px;
    padding: 20px;
    padding-bottom: 200px !important; /* Space for FAB bar */
  }

  /* MIL & SPL: 2 Columns on Mobile */
  /* MIL: 2 Columns on Mobile */
  .mil-grid-container {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px; /* Tighter gap for 2-col */
    padding: 10px; /* Reduced padding */
    padding-bottom: 200px !important; /* Space for FAB bar */
  }

  /* SPL: 2 Columns on Mobile (Mirroring MIL) */
  .grid-container.spl-mode {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px; /* Tighter gap for 2-col to match MIL */
    padding: 10px;
    padding-bottom: 200px !important;
  }

  /* Override inner SPL grid for mobile to allow shrinking */
  .spl-grid {
    grid-template-columns: 1fr !important; /* Stack variants inside the card on mobile */
  }

  /* Compact card styling for 2-column mobile grid */
  .mil-card,
  .spl-card {
    padding: 6px !important;
  }

  .spl-visual,
  .mil-visual {
    height: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 6px !important;
    aspect-ratio: 1 / 1; /* Square images */
  }

  .spl-content,
  .mil-content {
    padding: 6px !important;
    gap: 6px !important;
  }

  /* Adjust typography for 2-column mobile grid */
  .spl-region,
  .mil-title {
    font-size: 0.75rem !important;
    line-height: 1.2;
  }
  .spl-code,
  .mil-code,
  .mil-price-label {
    font-size: 0.6rem !important;
  }
  .spl-v-price,
  .mil-price-value {
    font-size: 0.75rem !important;
    font-weight: 600;
  }

  .spl-header {
    padding-bottom: 6px !important;
    margin-bottom: 6px !important;
  }

  .spl-grid {
    gap: 4px !important;
    grid-template-columns: 1fr !important; /* Single column for variants on mobile */
  }

  .spl-variant {
    padding: 6px 8px !important;
  }

  /* PRODUCT CARDS */
  .product-card {
    max-width: 100%;
  }

  .product-image {
    height: 250px;
    /* Taller images on mobile */
  }

  .size-btn {
    padding: 10px;
    /* Larger touch targets */
  }

  /* ADMIN PANEL */
  .admin-container {
    padding: 0;
  }

  .admin-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-tabs {
    flex-wrap: wrap;
    /* Allow tabs to wrap */
    gap: 8px;
  }

  .admin-tab {
    flex: 1 1 45%;
    /* 2 tabs per row approx */
    text-align: center;
    padding: 10px;
    font-size: 0.9rem;
  }

  .admin-body {
    padding: 20px;
  }

  /* ADMIN FORMS */
  .form-row {
    flex-direction: column;
    gap: 16px;
  }

  .checkbox-group {
    gap: 12px;
  }

  .checkbox-group label {
    padding: 8px 0;
    /* Larger touch area */
  }

  /* RESPONSIVE TABLES (Scrollable) */
  .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
  }

  .data-table {
    min-width: 600px;
    /* Force scroll if too narrow */
  }

  .data-table th,
  .data-table td {
    padding: 12px 10px;
    white-space: nowrap;
    /* Prevent awkward wrapping */
  }

  /* MODALS */
  .modal {
    padding: 10px;
    align-items: flex-end;
    /* Bottom sheet feel on mobile */
  }

  .modal-content {
    max-height: 85vh;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    margin-bottom: 0;
  }

  .modal-footer {
    flex-direction: column-reverse;
    /* Save button on top or accessible */
  }

  .modal-footer button {
    width: 100%;
    padding: 14px;
  }

  /* PRICING GRID */
  #sec-pricing > div {
    grid-template-columns: 1fr !important;
    /* Stack pricing cards */
  }

  /* FLOATING ACTION BAR - Compact for mobile */
  .fab-bar {
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    width: calc(100% - 32px);
  }

  .fab-bar h4 {
    font-size: 0.9rem;
    margin-bottom: 4px;
  }

  .fab-bar p {
    font-size: 0.75rem;
  }

  .fab-actions {
    width: 100%;
    gap: 8px;
  }

  .fab-btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 0.85rem;
  }

  /* COLLECTION CONTROLS MOBILE */
  .collection-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 16px 20px;
  }

  .collection-controls .search-input-wrapper {
    max-width: 100%;
    width: 100%;
  }
  
  .collection-controls .btn-remix,
  .collection-controls button {
    width: 100%;
    margin-left: 0 !important;
    justify-content: center;
  }
}

/* --- SPL COLLECTION STYLES --- */

/* Wrapper & Layout */
.spl-wrapper {
  padding: 0 0 4rem 0;
  max-width: 1400px;
  margin: 0 auto;
}

/* Header & Controls */
.spl-header-container {
  margin-bottom: 2.5rem;
  background: white;
  padding: 24px 32px;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.spl-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.spl-header-top h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.25rem;
  font-family: var(--font-serif);
}

.spl-action-btn {
  display: flex;
  align-items: center;
  padding: 10px 18px;
  background: var(--primary);
  color: white;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}

.spl-action-btn:hover {
  background: black; /* Darker than primary */
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.spl-action-btn:active {
  transform: translateY(0);
}

.spl-controls-bar {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

/* Search */
.spl-search-box {
  position: relative;
  flex: 1;
  min-width: 280px;
  max-width: 400px;
}

.spl-search-box input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.95rem;
  transition: all 0.2s;
  background: var(--bg);
}

.spl-search-box input:focus {
  outline: none;
  border-color: var(--accent);
  background: white;
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1);
}

/* Filters */
.spl-filters {
  display: flex;
  gap: 0.75rem;
}

.spl-filter-btn {
  padding: 10px 20px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-light);
}

.spl-filter-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.spl-filter-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Grid Override - Match MIL 2-column layout */
.spl-product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 10px;
}

/* Product Card */
.spl-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: white;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  position: relative;
}

.spl-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
  border-color: var(--accent-light);
}

.spl-visual-container {
  padding: 1rem;
  background: linear-gradient(
    135deg,
    #fdfbfb 0%,
    #ebedee 100%
  );
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.spl-mask {
  width: 100%;
  aspect-ratio: 1;
  position: relative;
  overflow: hidden;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow:
    0 15px 35px -5px rgba(0, 0, 0, 0.2),
    0 5px 15px -5px rgba(0, 0, 0, 0.1);
}

.spl-card:hover .spl-mask {
  transform: scale(1.05) rotate(1deg);
}

/* Shape Masks */
.spl-mask.sq-mask {
  border-radius: 2px; /* Slight rounding for realism */
}

.spl-mask.hex-mask {
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  /* Hex shadow is tricky with clip-path, usually requires a wrapper or drop-shadow filter on the element itself */
  /* Re-apply shadow via filter for hex */
  box-shadow: none;
  filter: drop-shadow(0 15px 15px rgba(0, 0, 0, 0.15));
}

.spl-mask img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.spl-gloss-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      circle at 30% 30%,
      rgba(255, 255, 255, 0.8) 0%,
      rgba(255, 255, 255, 0) 20%
    ),
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.4) 0%,
      rgba(255, 255, 255, 0) 40%,
      rgba(0, 0, 0, 0.1) 100%
    );
  pointer-events: none;
  mix-blend-mode: overlay;
  opacity: 0.9;
}

.spl-card-info {
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  background: #fff;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.spl-code-tag {
  font-size: 0.7rem;
  font-family: monospace;
  color: var(--text-light);
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  display: inline-block;
  margin-bottom: 6px;
}

.spl-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
  line-height: 1.3;
}

.spl-dot-group {
  display: flex;
  gap: 6px;
  align-items: center;
}

.spl-color-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid white;
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(0,0,0,0.05);
  flex-shrink: 0;
}


.spl-badge {
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.spl-badge.black {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.spl-badge.gray {
  color: var(--text-light);
  background: var(--bg);
}

.spl-divider {
  height: 1px;
  background: var(--border);
  margin: 1rem 0;
  opacity: 0.6;
}

.spl-price-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: auto; /* Push to bottom */
}

.spl-price-box {
  background: var(--bg);
  padding: 10px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.spl-card:hover .spl-price-box {
  border-color: var(--border);
  background: white;
}

.spl-price-label {
  font-size: 0.7rem;
  color: var(--text-light);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.spl-price-val {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
}

/* SPL Filter Buttons - Clay/Earth Tones */
.spl-filter-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: 2px solid transparent;
  background: transparent;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #78716c; /* Warm stone gray */
  white-space: nowrap;
}

.spl-filter-btn:hover {
  background: #fef3c7; /* Light warm yellow */
  color: #78350f; /* Dark clay brown */
  border-color: #fde68a;
}

.spl-filter-btn.active {
  background: linear-gradient(
    135deg,
    #92400e 0%,
    #78350f 100%
  ); /* Dark clay gradient */
  color: #fef3c7; /* Light cream text */
  border-color: #92400e;
  box-shadow: 0 2px 8px rgba(120, 53, 15, 0.25);
}

.spl-filter-btn.active:hover {
  background: linear-gradient(
    135deg,
    #78350f 0%,
    #451a03 100%
  ); /* Even darker on hover */
  box-shadow: 0 4px 12px rgba(120, 53, 15, 0.35);
}

/* Mobile Adjustments for SPL */
@media (max-width: 768px) {
  .spl-header-top {
    flex-direction: column;
    align-items: stretch;
  }

  .spl-action-btn {
    justify-content: center;
  }

  .spl-controls-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .spl-search-box {
    max-width: none;
  }

  .spl-filters {
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .spl-filter-btn {
    white-space: nowrap;
  }
}

/* ADMIN PAGINATION CONTROLS */
.pagination-controls {
  display: flex;
  justify-content: flex-end;
  /* Align to right like the screenshot implies or center? Screenshot showed left alignment actually but standard is usually right or center. Let's do center/right. Screenshot shows left actually. Let's keep it simple standard flex. */
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding: 10px;
}

.pagination-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.pagination-controls button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.pagination-controls button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f5f5f5;
  color: #999;
  box-shadow: none;
}

.pagination-controls #page-indicator {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-light);
  min-width: 80px;
  text-align: center;
  font-family: var(--font-sans);
}

/* GALLERY STYLES */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem 0;
}

.gallery-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.gallery-image-wrapper {
    position: relative;
    padding-top: 100%; /* Square */
    overflow: hidden;
    background: #f4f4f4;
}

.gallery-image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-card:hover .gallery-image-wrapper img {
    transform: scale(1.05);
}

.gallery-details {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.gallery-name {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    color: var(--primary);
}

.gallery-meta {
    font-size: 0.85rem;
    color: var(--text-light);
    display: flex;
    justify-content: space-between;
    margin-top: auto;
}

.admin-gallery-actions {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    text-align: right;
}

.btn-delete-img {
    background: white;
    border: 1px solid #fed7d7;
    color: #c53030;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-delete-img:hover {
    background: #fff5f5;
    border-color: #e53e3e;
}

/* QTY INPUTS */
.qty-input {
    width: 100px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
}

.qty-input:focus {
    border-color: var(--accent);
    outline: none;
}

/* CUSTOM FILE UPLOAD */
.file-upload-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

input[type="file"] {
    display: none;
}

.custom-file-upload {
    display: inline-block;
    padding: 8px 16px;
    cursor: pointer;
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text);
    transition: all 0.2s;
    font-weight: 500;
}

.custom-file-upload:hover {
    background: #f9fafb;
    border-color: var(--accent);
    color: var(--accent);
}

#file-name-display {
    font-size: 0.85rem;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

/* Gallery Selection Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.product-card {
    transition: all 0.3s ease;
}

.product-card.selected-card {
    border: 3px solid #10b981 !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
}
