/* ============================================================
   STYLE.CSS — BarberTeste Premium
   Versão melhorada: melhor organização, animações refinadas,
   utilitários extras e performance otimizada.
   ============================================================ */

/* ------------------------------------------------------------
   1. RESET & BASE
   ------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;
  max-width: 100vw;
  /* Garante que fontes renderizem com suavidade no iOS/macOS */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  -webkit-tap-highlight-color: transparent;
  background-color: #020617; /* slate-950 */
}

/* ------------------------------------------------------------
   2. INPUTS — CORREÇÕES CROSS-BROWSER
   ------------------------------------------------------------ */

/* Evita inputs de data/mês "vazando" na tela no Safari/iOS */
input[type="date"],
input[type="month"] {
  -webkit-appearance: none !important;
  appearance: none !important;
  min-width: 0;
  max-width: 100%;
}

/* Cor do texto do placeholder em inputs de data no WebKit */
input[type="date"]::-webkit-datetime-edit-text,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-year-field,
input[type="month"]::-webkit-datetime-edit-text,
input[type="month"]::-webkit-datetime-edit-month-field,
input[type="month"]::-webkit-datetime-edit-year-field {
  color: inherit;
}

/* Remove o ícone de calendário nativo no Chrome/Edge para não conflitar com o ícone Lucide */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
  opacity: 0;
  width: 100%;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  cursor: pointer;
}

/* Remove a seta de select nativa (substituída pelo design do Tailwind) */
select {
  -webkit-appearance: none;
  appearance: none;
}

/* ------------------------------------------------------------
   3. CONTROLE DE VISIBILIDADE DE TELAS
   ------------------------------------------------------------ */
.hidden-view {
  display: none !important;
}

/* ------------------------------------------------------------
   4. SCROLLBAR CUSTOMIZADA
   ------------------------------------------------------------ */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 10px;
  transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Oculta scrollbar sem perder funcionalidade */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ------------------------------------------------------------
   5. EFEITOS VISUAIS — GLASS, GRADIENTES, TEXTURAS
   ------------------------------------------------------------ */

/* Glassmorphism reutilizável */
.glass-panel {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Efeito de brilho sutil nos cards ao hover */
.card-glow:hover {
  box-shadow:
    0 0 0 1px rgba(245, 158, 11, 0.15),
    0 10px 40px -10px rgba(245, 158, 11, 0.1);
  transition: box-shadow 0.3s ease;
}

/* Separador decorativo com gradiente */
.divider-glow {
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(245, 158, 11, 0.3),
    transparent
  );
  border: none;
  margin: 0;
}

/* ------------------------------------------------------------
   6. ANIMAÇÕES
   ------------------------------------------------------------ */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 0.5rem;
}

/* Spinner de loading */
.spin {
  animation: spin 0.8s linear infinite;
}

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

/* Pulso suave para estados de atenção */
@keyframes pulse-amber {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.3);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(245, 158, 11, 0);
  }
}

.pulse-amber {
  animation: pulse-amber 2s ease-in-out infinite;
}

/* ------------------------------------------------------------
   7. BARRA DE PROGRESSO (FIDELIDADE)
   ------------------------------------------------------------ */
.progress-fill {
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ------------------------------------------------------------
   8. TOOLTIPS — APENAS DESKTOP
   ------------------------------------------------------------ */
.tooltip,
.tooltip-left {
  position: relative;
}

@media (min-width: 768px) {
  .tooltip:hover::after,
  .tooltip-left:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    background-color: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 50;
    pointer-events: none;
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.15s ease-out forwards;
  }

  .tooltip:hover::after {
    left: 50%;
    transform: translateX(-50%);
  }

  .tooltip-left:hover::after {
    right: 0;
  }
}

/* ------------------------------------------------------------
   9. TOAST NOTIFICATIONS
   ------------------------------------------------------------ */
#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  /* Garante que não ultrapasse a tela em mobile */
  max-width: calc(100vw - 2rem);
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.125rem;
  border-radius: 0.875rem;
  color: white;
  font-weight: 600;
  font-size: 0.875rem;
  box-shadow:
    0 10px 25px -5px rgba(0, 0, 0, 0.4),
    0 4px 6px -2px rgba(0, 0, 0, 0.2);
  animation: slideDown 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.toast.success {
  background-color: rgba(16, 185, 129, 0.92);
}
.toast.error {
  background-color: rgba(239, 68, 68, 0.92);
}
.toast.info {
  background-color: rgba(59, 130, 246, 0.92);
}

.toast-removing {
  animation: slideUp 0.25s ease-in forwards;
  opacity: 0;
}

/* ------------------------------------------------------------
   10. BOTÕES — ESTADOS E VARIANTES
   ------------------------------------------------------------ */

/* Estado de loading nos botões de submit */
button[disabled] {
  cursor: not-allowed;
  opacity: 0.7;
}

/* Focus ring acessível para teclado */
button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid rgba(245, 158, 11, 0.6);
  outline-offset: 2px;
}

/* ------------------------------------------------------------
   11. TABELA — LINHAS ZEBRADAS SUAVES
   ------------------------------------------------------------ */
tbody tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.015);
}

tbody tr {
  transition: background-color 0.15s ease;
}

tbody tr:hover {
  background-color: rgba(245, 158, 11, 0.04);
}

/* ------------------------------------------------------------
   12. CARDS DE HORÁRIO (TIME SLOTS)
   ------------------------------------------------------------ */

/* Animação de entrada em cascata para os slots de horário */
.time-slot-btn {
  animation: scaleIn 0.2s ease-out both;
}

/* Gera delays escalonados para os primeiros 12 slots */
.time-slot-btn:nth-child(1) {
  animation-delay: 0.02s;
}
.time-slot-btn:nth-child(2) {
  animation-delay: 0.04s;
}
.time-slot-btn:nth-child(3) {
  animation-delay: 0.06s;
}
.time-slot-btn:nth-child(4) {
  animation-delay: 0.08s;
}
.time-slot-btn:nth-child(5) {
  animation-delay: 0.1s;
}
.time-slot-btn:nth-child(6) {
  animation-delay: 0.12s;
}
.time-slot-btn:nth-child(7) {
  animation-delay: 0.14s;
}
.time-slot-btn:nth-child(8) {
  animation-delay: 0.16s;
}
.time-slot-btn:nth-child(9) {
  animation-delay: 0.18s;
}
.time-slot-btn:nth-child(10) {
  animation-delay: 0.2s;
}
.time-slot-btn:nth-child(11) {
  animation-delay: 0.22s;
}
.time-slot-btn:nth-child(12) {
  animation-delay: 0.24s;
}

/* ------------------------------------------------------------
   13. SELEÇÃO DE TEXTO
   ------------------------------------------------------------ */
::selection {
  background-color: rgba(245, 158, 11, 0.25);
  color: #fef3c7;
}
