/* ======================================================
   MadCo PCB Gallery styles — board cards, toolbar, modal
   PCB palette: emerald / gold / dark copper.
   Theme-aware (uses variables from css/style.css)
   ====================================================== */

/* ---------- HERO ---------- */
.store-hero { padding: 140px 0 40px; text-align: center; position: relative; overflow: hidden; }
.store-hero h1 { font-size: 44px; font-weight: 800; letter-spacing: -1px; margin: 0 0 12px 0; }
[dir="rtl"] .store-hero h1 { letter-spacing: 0; }
.store-hero h1 .gradient { background: linear-gradient(135deg, #10B981, #84CC16); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
[data-theme="light"] .store-hero h1 .gradient { background: linear-gradient(135deg, #059669, #65A30D); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.store-desc { color: var(--text-muted); font-size: 17px; line-height: 1.7; max-width: 560px; margin: 0 auto 24px auto; }
.store-count { display: inline-flex; align-items: center; gap: 6px; background: var(--card-soft); border: 1px solid var(--border-strong); padding: 7px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text-faint); }
.store-count #storeCount { color: var(--accent-text); font-weight: 800; }
.pcb-hero .store-count #storeCount { color: #34D399; }
[data-theme="light"] .pcb-hero .store-count #storeCount { color: #059669; }

/* ---------- TOOLBAR ---------- */
.store-toolbar { padding: 8px 0 40px; }
.store-toolbar .container { display: flex; gap: 14px; flex-wrap: wrap; }
.store-search {
  flex: 1; min-width: 240px; background: var(--card); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 12px; padding: 12px 18px;
  font-size: 14px; font-family: inherit; outline: none; transition: border-color 0.2s;
}
.store-search:focus { border-color: #34D399; }
.store-search::placeholder { color: var(--text-dim); }
.store-category {
  background: var(--card); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 12px; padding: 12px 14px; font-size: 14px; font-family: inherit;
  cursor: pointer; outline: none;
}
.store-category option { background: var(--card); color: var(--text); }
.admin-link {
  margin-left: auto; background: var(--card); border: 1px solid var(--border-strong);
  color: var(--text-muted); border-radius: 12px; padding: 12px 16px; font-size: 13px;
  font-weight: 600; text-decoration: none; transition: border-color 0.2s, color 0.2s;
}
.admin-link:hover { border-color: #34D399; color: var(--text); }

/* ---------- BOARD GRID ---------- */
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; padding-bottom: 100px; }
.pcb-card {
  background: var(--card); border: 1px solid var(--border-strong); border-radius: 18px;
  padding: 0; overflow: hidden; display: flex; flex-direction: column; cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}
.pcb-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: rgba(52, 211, 153, 0.5); }
.pcb-card-body { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 10px; }

/* ---------- BOARD VISUALS (CSS-drawn PCB) ---------- */
.pcb-visual {
  height: 200px; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.pcb-visual[hidden] { display: none; }
.pcb-visual-photo img { width: 100%; height: 100%; object-fit: cover; }
.pcb-visual-green { background: linear-gradient(135deg, #064E3B, #065F46); }
.pcb-visual-blue { background: linear-gradient(135deg, #1E3A5F, #1E40AF); }
.pcb-visual-purple { background: linear-gradient(135deg, #701A75, #A21CAF); }
.pcb-visual-orange { background: linear-gradient(135deg, #7C2D12, #C2410C); }
.pcb-visual-indigo { background: linear-gradient(135deg, #312E81, #4338CA); }
[data-theme="light"] .pcb-visual-green { background: linear-gradient(135deg, #9FE3C6, #6FCFA3); }
[data-theme="light"] .pcb-visual-blue { background: linear-gradient(135deg, #B9D4F6, #8FB8EC); }
[data-theme="light"] .pcb-visual-purple { background: linear-gradient(135deg, #DFC3EE, #CB9BE1); }
[data-theme="light"] .pcb-visual-orange { background: linear-gradient(135deg, #FBDCB6, #F8C28B); }
[data-theme="light"] .pcb-visual-indigo { background: linear-gradient(135deg, #CCD1F8, #A9B1F1); }

.pcb-chip {
  width: 72px; height: 52px; border-radius: 6px; background: #0F172A;
  border: 2px solid rgba(250, 204, 21, 0.55); box-shadow: 0 0 18px rgba(250, 204, 21, 0.25);
  z-index: 2; position: relative;
}
.pcb-chip::before, .pcb-chip::after {
  content: ''; position: absolute; width: 18px; height: 18px;
  border: 2px solid rgba(250, 204, 21, 0.5);
}
.pcb-chip::before { top: -8px; left: -8px; border-right: 0; border-bottom: 0; }
.pcb-chip::after { bottom: -8px; right: -8px; border-left: 0; border-top: 0; }
[data-theme="light"] .pcb-chip { background: #1E293B; }
[data-theme="light"] .pcb-chip::before, [data-theme="light"] .pcb-chip::after { border-color: rgba(180, 140, 10, 0.7); }

.pcb-trace { position: absolute; background: rgba(250, 204, 21, 0.35); border-radius: 2px; z-index: 1; }
.pcb-trace-1 { width: 160px; height: 3px; top: 62%; left: 50%; transform: translateX(-50%) rotate(-8deg); }
.pcb-trace-2 { width: 120px; height: 3px; top: 30%; left: 12%; transform: rotate(24deg); }
.pcb-trace-3 { width: 130px; height: 3px; top: 22%; right: 10%; transform: rotate(-20deg); }
[data-theme="light"] .pcb-trace { background: rgba(146, 64, 14, 0.35); }

.grid-overlay { position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent, transparent 19px, rgba(255, 255, 255, 0.04) 20px), repeating-linear-gradient(90deg, transparent, transparent 19px, rgba(255, 255, 255, 0.04) 20px); }
[data-theme="light"] .grid-overlay { background: repeating-linear-gradient(0deg, transparent, transparent 19px, rgba(15, 23, 42, 0.06) 20px), repeating-linear-gradient(90deg, transparent, transparent 19px, rgba(15, 23, 42, 0.06) 20px); }

.layer-badge {
  position: absolute; bottom: 12px; left: 12px; z-index: 3;
  background: rgba(0, 0, 0, 0.55); padding: 4px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 700; color: #4ADE80;
}
[data-theme="light"] .layer-badge { background: rgba(255, 255, 255, 0.8); color: #10734A; }

/* ---------- CARD CONTENT ---------- */
.pcb-card .app-category { font-size: 12px; font-weight: 700; color: #34D399; text-transform: uppercase; letter-spacing: 0.5px; }
[data-theme="light"] .pcb-card .app-category { color: #059669; }
[dir="rtl"] .pcb-card .app-category { letter-spacing: 0; }
.pcb-card .app-name { font-size: 18px; font-weight: 700; margin: 0; }
.pcb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pcb-chip-spec {
  background: var(--card-soft); border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 4px 10px; font-size: 11px; font-weight: 600; color: var(--text-muted);
}
.pcb-card .app-short { font-size: 14px; color: var(--text-muted); line-height: 1.6; margin: 0; }
.pcb-card .app-card-actions { display: flex; gap: 10px; margin-top: 6px; }
.pcb-card .app-btn { padding: 10px 18px; font-size: 13px; background: linear-gradient(135deg, #10B981, #059669); }
.pcb-card .app-btn:hover { transform: translateY(-1px); }

/* ---------- EMPTY / ERROR ---------- */
.store-message { text-align: center; padding: 60px 0 100px; color: var(--text-faint); font-size: 15px; }

/* ---------- DETAIL MODAL ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(2, 6, 23, 0.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 20px; overflow-y: auto;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--card); border: 1px solid var(--border-strong); border-radius: 20px;
  max-width: 760px; width: 100%; padding: 28px; position: relative; box-shadow: var(--shadow-card);
}
.modal-close {
  position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border-radius: 10px;
  background: var(--card-soft); border: 1px solid var(--border-strong); color: var(--text);
  font-size: 14px; cursor: pointer; line-height: 1;
}
[dir="rtl"] .modal-close { right: auto; left: 16px; }
.modal-head { display: flex; gap: 16px; align-items: center; margin-bottom: 20px; }
.modal-name { font-size: 24px; font-weight: 800; margin: 0 0 4px 0; }
.modal-cat { font-size: 13px; color: #34D399; font-weight: 600; }
[data-theme="light"] .modal-cat { color: #059669; }

.pcb-visual-sm { width: 72px; height: 72px; border-radius: 14px; flex-shrink: 0; }
.pcb-visual-sm .pcb-chip { width: 30px; height: 22px; border-width: 1px; }
.pcb-visual-sm .pcb-chip::before, .pcb-visual-sm .pcb-chip::after { width: 8px; height: 8px; border-width: 1px; }
.pcb-visual-sm .pcb-trace-1 { width: 60px; height: 2px; }
.pcb-visual-sm .pcb-trace-2 { width: 44px; height: 2px; }
.pcb-visual-sm .pcb-trace-3 { width: 48px; height: 2px; }
.pcb-visual-sm .layer-badge { display: none; }
.pcb-modal-img { width: 100%; height: 100%; object-fit: cover; }

.modal-gallery { position: relative; border-radius: 16px; overflow: hidden; background: var(--bg-soft); margin-bottom: 12px; }
.pcb-modal-gallery img { aspect-ratio: 4 / 3; }
.modal-photo { width: 100%; display: block; object-fit: cover; }
.gallery-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255, 255, 255, 0.92); color: #0F172A; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}
.gallery-prev { left: 12px; }
.gallery-next { right: 12px; }
[dir="rtl"] .gallery-prev { left: auto; right: 12px; }
[dir="rtl"] .gallery-next { right: auto; left: 12px; }
.photo-thumbs { display: flex; gap: 10px; margin-bottom: 24px; }
.photo-thumbs[hidden] { display: none; }
.photo-thumb {
  width: 64px; height: 64px; border-radius: 10px; object-fit: cover; cursor: pointer;
  border: 2px solid transparent; opacity: 0.7; transition: border-color 0.2s, opacity 0.2s;
}
.photo-thumb:hover { opacity: 1; }
.photo-thumb.active { border-color: #34D399; opacity: 1; }

.modal-desc { color: var(--text-muted); font-size: 15px; line-height: 1.8; margin-bottom: 24px; }
.modal-section-title {
  font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: var(--text); margin: 0 0 12px 0;
}
[dir="rtl"] .modal-section-title { letter-spacing: 0; }
.feature-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.feature-chip { background: var(--card-soft); border: 1px solid var(--border-strong); border-radius: 999px; padding: 6px 14px; font-size: 12px; font-weight: 600; }
.pcb-feature-chip { border-color: rgba(52, 211, 153, 0.35); color: var(--text); }
.modal-info {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 24px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px 20px; margin-bottom: 24px;
}
.info-item .label { font-size: 11px; color: var(--text-faint); letter-spacing: 0.5px; text-transform: uppercase; }
.info-item .value { font-size: 14px; font-weight: 600; margin-top: 2px; word-break: break-all; }
.modal-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-order {
  background: linear-gradient(135deg, #10B981, #059669); color: #fff; padding: 14px 28px;
  border-radius: 10px; font-weight: 600; font-size: 15px; text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px; border: none; cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}
.btn-order:hover { transform: translateY(-2px); }
.btn-ghost {
  background: var(--card-soft); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 12px 22px; font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: background 0.2s;
}
.btn-ghost:hover { background: var(--hover); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
  .store-hero { padding-top: 110px; }
  .store-hero h1 { font-size: 32px; }
  .modal { padding: 20px; }
  .modal-info { grid-template-columns: 1fr; }
  .pcb-visual { height: 160px; }
}
