/* ============ GLOBAL — Estilos globais da aplicação CustomWare ============
   Carregado antes de todos os outros CSS do plugin.
   Use este arquivo para estilos que devem afetar toda a aplicação. */

/* ──────────────────────────────────────────────────────────────
   Personalização de scroll — aplicada a toda a app
   Alvo: qualquer elemento scrollável dentro de #customware-root
   ────────────────────────────────────────────────────────────── */

/* Firefox */
#customware-root * {
  scrollbar-width: thin;
  scrollbar-color: rgba(254, 189, 13, 0.22) transparent;
}

/* Chrome, Edge, Safari */
#customware-root *::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
#customware-root *::-webkit-scrollbar-track {
  background: transparent;
}
#customware-root *::-webkit-scrollbar-thumb {
  background: rgba(254, 189, 13, 0.22);
  border-radius: 4px;
  transition: background 200ms;
}
#customware-root *::-webkit-scrollbar-thumb:hover {
  background: rgba(254, 189, 13, 0.50);
}
#customware-root *::-webkit-scrollbar-corner {
  background: transparent;
}

/* ──────────────────────────────────────────────────────────────
   Shell — wrapper do App; centraliza horizontalmente o conteúdo
   dentro do espaço útil (já descontado do menu lateral via JS).
   Define UMA largura máxima fluida para qualquer tela carregada
   pelo app.jsx — cada página apenas preenche o shell.
   ────────────────────────────────────────────────────────────── */

#customware-root .cw-app-shell {
  align-items: stretch;       /* filhos esticam ao 100% do shell */
  width: 100%;
  max-width: none;            /* scrollbar na extrema direita da janela */
  margin-left: 0;
  margin-right: 0;
  padding-left: 0;
  padding-right: 0;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  #customware-root .cw-app-shell {
    padding-left: 0;
    padding-right: 0;
  }
}

/* ──────────────────────────────────────────────────────────────
   Card — container padrão de seções da app
   ────────────────────────────────────────────────────────────── */

#customware-root .card {
  background: rgba(8, 52, 76, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 28px 32px;
  margin-top: 14px;
}

@media (max-width: 640px) {
  #customware-root .card {
    padding: 20px !important;
    margin: 0 12px !important;
    border-radius: 12px !important;
  }
  #customware-root .page {
    padding: 0 !important;
    gap: 8px !important;
  }
  #customware-root {
    width: 100% !important;
    height: 100% !important;
  }
}
@media (max-width: 480px) {
  #customware-root .card {
    padding: 16px 14px;
    margin: 0 8px !important;
    border-radius: 10px;
  }
  #customware-root .page {
    padding: 0 !important;
  }
}

/* ──────────────────────────────────────────────────────────────
   Botões — sistema global de botões
   Variantes: primary, secondary, ghost, danger, success
   Tamanhos:  sm (padrão), md, lg
   Extras:    btn-block (largura total), btn-icon (quadrado)
   ────────────────────────────────────────────────────────────── */

/* Base */
#customware-root .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: -0.01em;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  text-decoration: none;
  outline: none;
  transition: background 160ms, border-color 160ms, opacity 160ms, transform 120ms, box-shadow 160ms;
  user-select: none;
  position: relative;
}
#customware-root .btn:active {
  transform: scale(0.97);
}
#customware-root .btn:disabled,
#customware-root .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  pointer-events: none;
}

/* ── Primary — ação principal (dourado) ── */
#customware-root .btn-primary {
  background: var(--destaque);
  color: var(--primaria);
  border-color: var(--destaque);
}
#customware-root .btn-primary:hover {
  background: #ffd152;
  border-color: #ffd152;
  box-shadow: 0 4px 16px rgba(254, 189, 13, 0.28);
}
#customware-root .btn-primary:focus-visible {
  box-shadow: 0 0 0 3px rgba(254, 189, 13, 0.35);
}

/* ── Secondary — ação secundária (azul delineado) ── */
#customware-root .btn-secondary {
  background: rgba(8, 52, 76, 0.5);
  color: var(--text-1);
  border-color: rgba(255, 255, 255, 0.18);
}
#customware-root .btn-secondary:hover {
  background: rgba(8, 52, 76, 0.75);
  border-color: rgba(255, 255, 255, 0.30);
}
#customware-root .btn-secondary:focus-visible {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}

/* ── Ghost — ação terciária (transparente) ── */
#customware-root .btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-2);
  border-color: rgba(255, 255, 255, 0.10);
}
#customware-root .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.10);
  color: var(--text-1);
  border-color: rgba(255, 255, 255, 0.18);
}
#customware-root .btn-ghost:focus-visible {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}

/* ── Danger — ação destrutiva (vermelho) ── */
#customware-root .btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #FCA5A5;
  border-color: rgba(239, 68, 68, 0.30);
}
#customware-root .btn-danger:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.50);
  color: #fff;
}
#customware-root .btn-danger:focus-visible {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25);
}

/* ── Success — confirmação (verde) ── */
#customware-root .btn-success {
  background: rgba(34, 197, 94, 0.12);
  color: #4ADE80;
  border-color: rgba(34, 197, 94, 0.30);
}
#customware-root .btn-success:hover {
  background: rgba(34, 197, 94, 0.22);
  border-color: rgba(34, 197, 94, 0.50);
  color: #fff;
}
#customware-root .btn-success:focus-visible {
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
}

/* ── Tamanhos ── */
#customware-root .btn-sm {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 8px;
  gap: 5px;
}
#customware-root .btn-lg {
  padding: 12px 28px;
  font-size: 15px;
  border-radius: 12px;
  gap: 9px;
}

/* ── Largura total ── */
#customware-root .btn-block {
  width: 100%;
}

/* ── Ícone apenas (quadrado) ── */
#customware-root .btn-icon {
  padding: 9px;
  aspect-ratio: 1;
  border-radius: 10px;
}
#customware-root .btn-icon.btn-sm { padding: 6px; border-radius: 8px; }
#customware-root .btn-icon.btn-lg { padding: 12px; border-radius: 12px; }

/* ──────────────────────────────────────────────────────────────
   Inputs globais — input, textarea e select
   Cores extraídas da tela de perfil e promovidas como padrão
   ────────────────────────────────────────────────────────────── */

#customware-root input,
#customware-root textarea {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: #f0f4f8;
  width: 100%;
  box-sizing: border-box;
  outline: none;
  transition: border-color 160ms, background-color 160ms;
}
#customware-root input:hover,
#customware-root textarea:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background-color: rgba(255, 255, 255, 0.09);
}
#customware-root input:focus,
#customware-root textarea:focus {
  border-color: #FEBD0D;
  background-color: rgba(255, 255, 255, 0.09);
}
#customware-root input:disabled,
#customware-root textarea:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
#customware-root input::placeholder,
#customware-root textarea::placeholder {
  color: #6b8fa8;
  font-style: normal;
}
#customware-root textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.55;
}

/* ──────────────────────────────────────────────────────────────
   Dropdown (select) — personalização global
   Remove a aparência nativa e aplica o visual do layout
   ────────────────────────────────────────────────────────────── */

/* Seta padrão — chevron cinza-azulado (#6b8fa8) */
#customware-root select {
  appearance: none;
  -webkit-appearance: none;
  background-color: rgba(255, 255, 255, 0.06);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b8fa8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 9px 36px 9px 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: #f0f4f8;
  width: 100%;
  box-sizing: border-box;
  cursor: pointer;
  outline: none;
  transition: border-color 160ms, background-color 160ms;
}

/* Hover — borda levemente mais visível */
#customware-root select:hover {
  border-color: rgba(255, 255, 255, 0.24);
  background-color: rgba(255, 255, 255, 0.09);
}

/* Focus — seta dourada (#FEBD0D) e borda destaque */
#customware-root select:focus {
  border-color: #FEBD0D;
  background-color: rgba(255, 255, 255, 0.09);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23FEBD0D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

/* Disabled */
#customware-root select:disabled {
  opacity: 0.40;
  cursor: not-allowed;
}

/* Opções — fundo escuro compatível com o tema */
#customware-root select option {
  background-color: #061E30;
  color: #f0f4f8;
}

/* ──────────────────────────────────────────────────────────────
   Responsividade — Foto de Perfil Mobile
   ────────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  /* Página de foto de perfil */
  #customware-root .page {
    padding: 0 !important;
    height: 100%;
    overflow-y: auto;
  }

  /* Canvas do editor */
  #customware-root canvas {
    width: 100% !important;
    height: auto !important;
    display: block;
  }

  /* Botões e controles */
  #customware-root .btn {
    font-size: 14px;
    padding: 10px 16px;
  }

  #customware-root .btn-primary {
    width: 100%;
  }
}

@media (max-width: 480px) {
  /* Extra small devices */
  #customware-root .page {
    padding: 0 !important;
    gap: 4px;
  }

  #customware-root .card {
    margin: 0 8px !important;
    padding: 12px !important;
    border-radius: 10px;
  }

  #customware-root .btn {
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 8px;
  }
}
