/* =============================================
   components/edit/edit-loja.css
============================================= */

/* ── Animações ─────────────────────────────── */
@keyframes edloja-fadein {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes edloja-slidein {
  from {
    transform: translateY(48px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

/* ── Overlay (fundo escuro) ────────────────── */
#editar-loja-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: edloja-fadein 0.2s ease;
}

/* ── Folha (bottom-sheet) ──────────────────── */
.edloja-sheet {
  background: var(--branco, #fff);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 540px;
  max-height: 92dvh;
  overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -8px 48px rgba(0, 0, 0, 0.18);
  animation: edloja-slidein 0.26s ease;
}

/* ── Cabeçalho ─────────────────────────────── */
.edloja-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.8rem;
  border-bottom: 1px solid var(--borda, #e5e7eb);
  position: sticky;
  top: 0;
  background: var(--branco, #fff);
  z-index: 1;
}

.edloja-header__esq {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.edloja-header__icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
  background: var(--azul-suave, #eff6ff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--azul-medio, #2563eb);
  font-size: 1.1rem;
}

.edloja-header__titulo {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--texto, #111);
}

.edloja-header__sub {
  margin: 0;
  font-size: 0.74rem;
  color: var(--texto-suave, #6b7280);
}

/* ── Botão fechar ──────────────────────────── */
.edloja-fechar {
  background: none;
  border: none;
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--texto-suave, #6b7280);
  font-size: 1.15rem;
  transition: background 0.15s;
  flex-shrink: 0;
}

.edloja-fechar:hover {
  background: var(--fundo, #f3f4f6);
}

/* ── Corpo ─────────────────────────────────── */
.edloja-body {
  padding: 1.1rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* ── Alertas inline ────────────────────────── */
.edloja-alerta {
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 600;
  display: none; /* visível por JS */
}

.edloja-alerta--erro {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.edloja-alerta--ok {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

/* ── Grupos de campo ───────────────────────── */
.edloja-grupo label {
  display: block;
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--texto-suave, #6b7280);
  margin-bottom: 0.32rem;
}

.edloja-grupo label i {
  margin-right: 0.25rem;
}

/* ── Inputs / selects / textareas ──────────── */
.edloja-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.64rem 0.85rem;
  border-radius: 10px;
  border: 1.5px solid var(--borda, #e5e7eb);
  background: var(--fundo-input, #f9fafb);
  color: var(--texto, #111);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  font-family: inherit;
}

.edloja-input:focus {
  border-color: var(--azul-medio, #2563eb);
}

.edloja-input--erro {
  border-color: var(--erro, #ef4444) !important;
}

/* ── Mensagem de erro por campo ────────────── */
.edloja-erro {
  font-size: 0.72rem;
  color: var(--erro, #ef4444);
  margin-top: 0.2rem;
  display: none; /* visível por JS */
}

/* ── Contador de caracteres ────────────────── */
.edloja-desc-count {
  font-size: 0.71rem;
  color: var(--texto-suave, #6b7280);
  display: block;
  text-align: right;
  margin-top: 0.2rem;
}

/* ── Rodapé (botões) ───────────────────────── */
.edloja-footer {
  display: flex;
  gap: 0.65rem;
  padding: 0.9rem 1.25rem 1.1rem;
  border-top: 1px solid var(--borda, #e5e7eb);
  position: sticky;
  bottom: 0;
  background: var(--branco, #fff);
}

/* ── Botões ────────────────────────────────── */
.edloja-btn {
  flex: 1;
  padding: 0.72rem;
  border-radius: 12px;
  border: none;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.edloja-btn:active {
  transform: scale(0.97);
}

.edloja-btn--cancel {
  background: var(--fundo, #f3f4f6);
  color: var(--texto, #111);
}

.edloja-btn--save {
  background: var(--azul-medio, #2563eb);
  color: #fff;
}

.edloja-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Spinner de loading ────────────────────── */
.edloja-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: edloja-spin 0.7s linear infinite;
  display: inline-block;
}

/* ══════════════════════════════════════════════
   DARK MODE — suporte completo
   Usa html.dark (mesmo padrão do resto da app)
══════════════════════════════════════════════ */

/* Folha */
html.dark .edloja-sheet {
  background: #1e293b;
  box-shadow: 0 -8px 48px rgba(0, 0, 0, 0.45);
}

/* Cabeçalho sticky */
html.dark .edloja-header {
  background: #1e293b;
  border-bottom-color: #334155;
}

html.dark .edloja-header__icon {
  background: #172033;
  color: #93c5fd;
}

html.dark .edloja-header__titulo {
  color: #f1f5f9;
}

html.dark .edloja-header__sub {
  color: #94a3b8;
}

/* Botão fechar */
html.dark .edloja-fechar {
  color: #94a3b8;
}

html.dark .edloja-fechar:hover {
  background: #334155;
}

/* Corpo */
html.dark .edloja-body {
  background: #1e293b;
}

/* Labels */
html.dark .edloja-grupo label {
  color: #94a3b8;
}

/* Inputs / selects / textareas */
html.dark .edloja-input {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

html.dark .edloja-input:focus {
  border-color: #3b82f6;
}

html.dark .edloja-input::placeholder {
  color: #475569;
}

/* Select — arrow visível no dark */
html.dark select.edloja-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%2394a3b8' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  appearance: none;
  -webkit-appearance: none;
}

/* Alertas */
html.dark .edloja-alerta--erro {
  background: #1e0808;
  color: #fca5a5;
  border-color: #7f1d1d;
}

html.dark .edloja-alerta--ok {
  background: #052e16;
  color: #86efac;
  border-color: #166534;
}

/* Contador de caracteres */
html.dark .edloja-desc-count {
  color: #64748b;
}

/* Rodapé sticky */
html.dark .edloja-footer {
  background: #1e293b;
  border-top-color: #334155;
}

/* Botão cancelar */
html.dark .edloja-btn--cancel {
  background: #334155;
  color: #f1f5f9;
}

html.dark .edloja-btn--cancel:hover {
  background: #475569;
}

/* Scrollbar discreta no dark */
html.dark .edloja-sheet::-webkit-scrollbar {
  width: 4px;
}
html.dark .edloja-sheet::-webkit-scrollbar-track {
  background: #1e293b;
}
html.dark .edloja-sheet::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}
