/* ═══════════════════════════════════════
   TOTAL ÓTICA — Admin Panel
   admin.css
═══════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --admin-bg:     #0f1117;
  --admin-card:   #1a1d27;
  --admin-border: #2a2d3a;
  --accent:       #7c6aff;
  --success:      #22c55e;
  --danger:       #ef4444;
  --yellow:       #FFD000;
  --yellow-dk:    #C9A800;
  --text:         #F5F0E8;
  --muted:        rgba(245,240,232,0.55);
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--admin-bg);
  color: var(--text);
  min-height: 100vh;
}

/* ─── TOPBAR ─── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15,17,23,0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--admin-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; height: 56px;
}

.topbar-logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem; color: var(--yellow); font-weight: 600;
}

.topbar-link {
  padding: 6px 16px; border-radius: 20px;
  border: 1px solid var(--admin-border);
  background: transparent; color: var(--muted);
  font-size: 0.8rem; font-weight: 500;
  text-decoration: none; transition: all 0.2s;
}

.topbar-link:hover {
  background: var(--yellow); color: var(--black);
  border-color: var(--yellow); font-weight: 600;
}

/* ─── LAYOUT ─── */
.admin-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.admin-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem; font-weight: 600; color: var(--yellow);
  margin-bottom: 0.3rem;
}

.admin-sub {
  font-size: 0.85rem; color: rgba(255,255,255,0.4);
  margin-bottom: 2rem;
}

/* ─── SECTION ─── */
.admin-section {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.admin-section-title {
  font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: rgba(255,255,255,0.35);
  margin-bottom: 1.2rem;
  display: flex; align-items: center; gap: 0.5rem;
}

.admin-section-title::after {
  content: ''; flex: 1; height: 1px; background: var(--admin-border);
}

/* ─── FORM ─── */
.form-row { display: grid; gap: 1rem; margin-bottom: 1rem; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }

label {
  font-size: 0.78rem; font-weight: 500;
  color: rgba(255,255,255,0.55);
}

input[type=text],
input[type=url],
input[type=number],
textarea,
select {
  background: #0a0c14;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--yellow);
}

textarea { resize: vertical; min-height: 70px; }
select option { background: #1a1d27; }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 9px 20px; border-radius: 8px; border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}

.btn-yellow  { background: var(--yellow); color: var(--black); }
.btn-yellow:hover { background: var(--yellow-dk); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--admin-border);
  color: var(--muted);
}
.btn-ghost:hover { border-color: var(--yellow); color: var(--yellow); }

.btn-danger {
  background: transparent;
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--danger);
}
.btn-danger:hover { background: rgba(239,68,68,0.1); }

.btn-sm  { padding: 6px 12px; font-size: 0.78rem; }
.btn-full { width: 100%; justify-content: center; }

/* ─── IMAGE UPLOAD ─── */
.img-upload-area {
  border: 2px dashed var(--admin-border);
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.img-upload-area:hover {
  border-color: var(--yellow);
  background: rgba(255,208,0,0.04);
}

.img-upload-area input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}

.img-upload-text { font-size: 0.8rem; color: var(--muted); }

.img-preview {
  width: 100%; max-height: 180px;
  object-fit: cover; border-radius: 8px; margin-top: 0.75rem;
  display: none;
}

/* ─── PRODUCT LIST ─── */
.prod-list { display: flex; flex-direction: column; gap: 0.75rem; }

.prod-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 1rem; align-items: center;
  background: #0a0c14;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}

.prod-thumb {
  width: 64px; height: 64px;
  border-radius: 8px; overflow: hidden;
  background: #111;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.prod-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.prod-thumb-ph  { font-size: 1.5rem; opacity: 0.3; }

.prod-info .prod-name { font-size: 0.9rem; font-weight: 500; margin-bottom: 0.2rem; }
.prod-info .prod-meta { font-size: 0.75rem; color: var(--muted); }

.prod-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

/* ─── SWITCH ─── */
.switch-row {
  display: flex; align-items: center;
  justify-content: space-between; padding: 0.6rem 0;
}

.switch { position: relative; width: 44px; height: 24px; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }

.switch-slider {
  position: absolute; inset: 0;
  background: #2a2d3a; border-radius: 24px; transition: 0.3s;
}

.switch-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: 0.3s;
}

.switch input:checked + .switch-slider { background: var(--yellow); }
.switch input:checked + .switch-slider::before {
  transform: translateX(20px); background: var(--black);
}

/* ─── TOAST ─── */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  background: var(--success); color: #fff;
  padding: 0.75rem 1.25rem; border-radius: 10px;
  font-size: 0.85rem; font-weight: 500;
  z-index: 999;
  transform: translateY(100px); opacity: 0;
  transition: all 0.3s; pointer-events: none;
}
.toast.show  { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--danger); }

/* ─── LOADING ─── */
.loading-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 3rem; color: var(--muted); font-size: 0.9rem; gap: 0.75rem;
}

.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,208,0,0.2);
  border-top-color: var(--yellow);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── EMPTY STATE ─── */
.empty-state {
  text-align: center; color: var(--muted);
  padding: 2.5rem; font-size: 0.875rem; line-height: 1.7;
}

/* ─── ADMIN TABS ─── */
.admin-tabs {
  display: flex;
  background: rgba(255,255,255,0.06);
  border-radius: 50px;
  padding: 4px;
  width: fit-content;
  margin-bottom: 1.75rem;
}

.admin-tab-btn {
  padding: 8px 28px;
  border-radius: 50px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.admin-tab-btn.active {
  background: var(--yellow);
  color: var(--black);
  font-weight: 600;
}

.admin-tab-panel { display: none; }
.admin-tab-panel.active { display: block; }

/* ─── RESPONSIVE ─── */
@media (max-width: 600px) {

  /* Topbar */
  .topbar { padding: 0 0.875rem; height: 52px; }
  .topbar-logo { font-size: 0.95rem; white-space: nowrap; }
  .topbar-hide-mobile { display: none; }
  .topbar-link { padding: 6px 12px; font-size: 0.85rem; white-space: nowrap; }

  /* Layout */
  .admin-wrap { padding: 1.25rem 0.875rem 3rem; }
  .admin-title { font-size: 1.15rem; }
  .admin-sub { font-size: 0.8rem; margin-bottom: 1.25rem; }

  /* Abas */
  .admin-tabs { width: 100%; }
  .admin-tab-btn { flex: 1; padding: 9px 8px; font-size: 0.85rem; text-align: center; }

  /* Seções */
  .admin-section { padding: 1rem; border-radius: 12px; }

  /* Formulários — empilhar colunas */
  .form-row.cols-2,
  .form-row.cols-3 { grid-template-columns: 1fr; }

  /* Inputs — font-size 16px evita zoom automático no iOS */
  input[type=text],
  input[type=url],
  input[type=number],
  textarea,
  select { font-size: 1rem; padding: 0.65rem 0.85rem; }

  /* Botão salvar full-width no mobile */
  .btn-yellow:not(.btn-sm) { width: 100%; justify-content: center; }

  /* Lista de produtos — thumb + info na primeira linha, ações na segunda */
  .prod-item {
    grid-template-columns: 52px 1fr;
    grid-template-rows: auto auto;
    gap: 0.75rem 0.75rem;
  }
  .prod-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
    padding-top: 0.5rem;
    border-top: 1px solid var(--admin-border);
  }
  .prod-actions .btn { flex: 1; justify-content: center; }

  /* Toast — ocupa largura total centralizado */
  .toast {
    left: 0.875rem;
    right: 0.875rem;
    bottom: 0.875rem;
    text-align: center;
  }
}
