/* Panel de administración: reutiliza las variables y tipografías de /style.css */
.admin-body { background: var(--bg-page); min-height: 100vh; }
[hidden] { display: none !important; }

.login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.login-card {
  width: 100%; max-width: 380px; background: var(--bg-card); padding: 2rem 1.5rem;
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md); border: 1px solid var(--border-color);
  display: flex; flex-direction: column; gap: 0.6rem; text-align: center;
}
.login-card h1 { font-family: var(--font-heading); font-size: 1.5rem; }
.login-card p { color: var(--text-muted); font-size: 0.92rem; }
.login-card label { text-align: left; font-weight: 600; font-size: 0.88rem; margin-top: 0.5rem; }
.login-icon { font-size: 2.4rem; }
.login-back { color: var(--text-muted); font-size: 0.88rem; margin-top: 0.5rem; }
.form-error { color: #b42318; background: #fef3f2; border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; font-size: 0.88rem; text-align: left; }

input[type="text"], input[type="password"], input[type="tel"], input[type="url"], input[type="number"], select, textarea {
  width: 100%; padding: 0.75rem 0.9rem; font: inherit; font-size: 1rem; /* 16px evita el zoom en iPhone */
  border: 1.5px solid var(--border-color); border-radius: var(--radius-md); background: #fff; color: var(--text-main);
}
textarea { resize: vertical; min-height: 5rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-glow); }

.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.85rem; }
.btn-danger { background: #fef3f2; color: #b42318; border: 1px solid #fecdca; }
.btn-danger:hover { background: #fee4e2; }

.admin-header { position: sticky; top: 0; z-index: 20; background: var(--bg-card); border-bottom: 1px solid var(--border-color); box-shadow: var(--shadow-sm); }
.admin-header-inner { max-width: 960px; margin: 0 auto; padding: 0.7rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.admin-title { font-family: var(--font-heading); font-size: 1.1rem; }
.admin-header-actions { display: flex; gap: 0.5rem; }
.admin-tabs { max-width: 960px; margin: 0 auto; display: flex; gap: 0.25rem; padding: 0 0.5rem; overflow-x: auto; }
.admin-tab { padding: 0.8rem 1rem; font-weight: 700; font-size: 0.95rem; color: var(--text-muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.admin-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.admin-main { max-width: 960px; margin: 0 auto; padding: 1rem 1rem 4rem; }
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin: 0.5rem 0 0.75rem; flex-wrap: wrap; }
.admin-toolbar h2 { font-family: var(--font-heading); font-size: 1.4rem; }
.admin-help { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1rem; }
.admin-empty { text-align: center; color: var(--text-muted); padding: 2.5rem 1rem; background: var(--bg-card); border: 1px dashed var(--border-color); border-radius: var(--radius-lg); }
.admin-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 1.25rem; box-shadow: var(--shadow-sm); }

.product-list, .category-list { display: flex; flex-direction: column; gap: 0.75rem; }
.product-row { display: grid; grid-template-columns: 72px 1fr; gap: 0.75rem 0.9rem; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 0.75rem; }
.product-row.is-soldout { background: #faf7f3; }
.product-row-thumb { width: 72px; height: 72px; border-radius: var(--radius-sm); object-fit: cover; background: var(--bg-subtle); display: flex; align-items: center; justify-content: center; font-size: 1.8rem; }
.product-row-name { font-weight: 700; line-height: 1.3; }
.product-row-meta { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.15rem; }
.tag { display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 0.1rem 0.55rem; border-radius: var(--radius-full); margin-right: 0.25rem; }
.tag-soldout { background: #2b3137; color: #fff; }
.tag-star { background: var(--accent-soft-yellow); color: #8a5a00; }
.product-row-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.product-row-actions .btn { flex: 1 1 auto; justify-content: center; }
.move-btns { display: flex; gap: 0.25rem; }
.move-btns .btn { flex: 0 0 auto; min-width: 2.6rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.category-row { display: flex; gap: 0.5rem; align-items: center; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 0.6rem; flex-wrap: wrap; }
.category-row input { flex: 1 1 180px; width: auto; }
.category-row small { color: var(--text-muted); width: 100%; }
.inline-form { display: flex; gap: 0.5rem; margin-bottom: 1rem; }

.form-stack { display: flex; flex-direction: column; gap: 1rem; }
.field label, .field-label { display: block; font-weight: 700; font-size: 0.9rem; margin-bottom: 0.3rem; }
.field small { display: block; color: var(--text-muted); font-size: 0.82rem; margin-top: 0.25rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.check { display: flex; align-items: center; gap: 0.6rem; font-weight: 600; padding: 0.4rem 0; }
.check input { width: 1.3rem; height: 1.3rem; accent-color: var(--primary); }

.photo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
.photo-slot { border: 1.5px dashed var(--border-color); border-radius: var(--radius-md); padding: 0.4rem; background: #fff; display: flex; flex-direction: column; gap: 0.4rem; }
.photo-slot img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: var(--radius-sm); }
.photo-empty { aspect-ratio: 1/1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); font-weight: 600; font-size: 0.9rem; cursor: pointer; border-radius: var(--radius-sm); background: var(--bg-subtle); text-align: center; padding: 0.5rem; }
.photo-empty span { font-size: 1.8rem; }
.photo-slot-actions { display: flex; gap: 0.3rem; }
.photo-slot-actions .btn { flex: 1; justify-content: center; padding: 0.4rem 0.3rem; font-size: 0.8rem; }
.photo-busy { opacity: 0.5; pointer-events: none; }
.logo-edit { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }
.logo-edit img { width: 72px; height: 72px; border-radius: var(--radius-md); object-fit: cover; border: 1px solid var(--border-color); background: var(--bg-subtle); }
.logo-edit-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.visually-hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.sheet-overlay { position: fixed; inset: 0; background: rgba(43, 49, 55, 0.5); z-index: 40; }
.sheet { position: fixed; z-index: 41; inset: 0; background: var(--bg-page); overflow-y: auto; }
.sheet-inner { max-width: 640px; margin: 0 auto; padding: 1rem 1rem 6rem; display: flex; flex-direction: column; gap: 1rem; }
.sheet-inner h2 { font-family: var(--font-heading); font-size: 1.4rem; }
.sheet-footer { position: fixed; bottom: 0; left: 0; right: 0; background: var(--bg-card); border-top: 1px solid var(--border-color); padding: 0.7rem 1rem; display: flex; gap: 0.6rem; justify-content: center; z-index: 42; }
.sheet-footer .btn { flex: 1; max-width: 300px; justify-content: center; }

.admin-toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translate(-50%, 150%); z-index: 100; max-width: calc(100vw - 2rem); padding: 0.8rem 1.2rem; border-radius: var(--radius-full); font-weight: 700; font-size: 0.95rem; color: #fff; background: var(--secondary); box-shadow: var(--shadow-lg); transition: transform 0.25s ease; text-align: center; }
.admin-toast.show { transform: translate(-50%, 0); }
.admin-toast.error { background: #b42318; }

@media (min-width: 640px) {
  .product-row { grid-template-columns: 72px 1fr auto; align-items: center; }
  .product-row-actions { grid-column: auto; flex-wrap: nowrap; }
  .product-row-actions .btn { flex: 0 0 auto; }
  .photo-grid { grid-template-columns: repeat(4, 1fr); }
  .sheet { inset: 2rem 0; max-width: 700px; margin: 0 auto; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
  .sheet-footer { position: sticky; margin: 0 -1rem; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
}
