/* styles.css */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #1f2937;
  --primary-dark: #111827;
  --secondary: #4b5563;
  --success: #059669;
  --bg: #f9fafb;
  --card: #ffffff;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 800px;
  margin: 0 auto;
}

.header {
  text-align: center;
  margin-bottom: 30px;
}

.header h1 {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.booking-card {
  background: var(--card);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 20px;
}

.step {
  display: none;
}

.step.active {
  display: block;
  animation: fadeIn 0.3s ease-in;
}

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

.step h2 {
  color: var(--primary);
  margin-bottom: 24px;
  font-size: 1.5rem;
}

/* Serviços */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.service-card {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.service-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.service-card.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.service-card h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.service-card p {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.service-card.selected h3,
.service-card.selected p {
  color: white;
}

/* Calendário */
.week-calendar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.day-card {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.day-card:hover:not(.disabled) {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.day-card.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.day-card.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.day-name {
  font-weight: 600;
  margin-bottom: 4px;
}

.day-number {
  font-size: 1.1rem;
}

/* Horários */
.horarios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}

.info-duracao {
  grid-column: 1 / -1;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  color: #1e40af;
  margin-bottom: 8px;
}

.info-duracao small {
  font-size: 0.9rem;
  font-weight: 500;
}

.horario-card {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.horario-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.horario-card.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.horario-inicio {
  font-weight: 700;
  font-size: 1.1rem;
}

.horario-fim {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.horario-card.selected .horario-fim {
  color: rgba(255, 255, 255, 0.8);
}

/* Formulário */
.form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-weight: 600;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

/* Resumo */
.resumo {
  background: var(--bg);
  padding: 20px;
  border-radius: 12px;
  margin-top: 20px;
}

.resumo h3 {
  color: var(--primary);
  margin-bottom: 12px;
}

.resumo p {
  margin-bottom: 8px;
  font-size: 1.05rem;
}

/* Botões */
.btn {
  padding: 14px 28px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 2px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg);
  border-color: var(--text);
  color: var(--text);
}

/* Navegação */
.navigation {
  margin-top: 24px;
  display: flex;
  justify-content: center;
}

/* Mensagem de sucesso */
.success-message {
  text-align: center;
  padding: 40px 20px;
}

.success-icon {
  width: 80px;
  height: 80px;
  background: var(--success);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: bold;
  margin: 0 auto 24px;
  animation: scaleIn 0.5s ease-out;
}

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

.success-message h2 {
  color: var(--success);
  margin-bottom: 16px;
}

.resumo-final {
  background: var(--bg);
  padding: 20px;
  border-radius: 12px;
  margin: 24px 0;
  text-align: left;
}

.resumo-final p {
  margin-bottom: 8px;
  font-size: 1.1rem;
}

/* Footer */
.footer {
  text-align: center;
  color: var(--text-muted);
  padding: 20px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.footer p {
  margin-bottom: 4px;
}

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.loading::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% {
    content: '.';
  }
  40% {
    content: '..';
  }
  60%, 100% {
    content: '...';
  }
}

/* Mensagem de erro */
.error-message {
  background: #fee;
  border: 1px solid #fcc;
  color: #c33;
  padding: 12px;
  border-radius: 8px;
  margin: 16px 0;
}

/* Divider */
.divider {
  margin: 24px 0;
  opacity: 0.2;
  border: none;
  border-top: 1px solid var(--border);
}

/* Responsividade */
@media (max-width: 768px) {
  .header h1 {
    font-size: 2rem;
  }

  .booking-card {
    padding: 20px;
  }

  .services-grid {
    grid-template-columns: 1fr;
  }

  .week-calendar {
    grid-template-columns: repeat(2, 1fr);
  }

  .horarios-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  body {
    padding: 10px;
  }

  .horarios-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Estilos para preço e duração nos serviços */
.service-card .duration {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 4px 0;
}

.service-card .price {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--primary);
  margin-top: 4px;
}

.service-card.selected .duration,
.service-card.selected .price {
  color: white;
}

/* Seção de consulta/cancelamento */
#consultaSection {
  margin-bottom: 24px;
}

#consultaSection h2 {
  color: var(--secondary);
  font-size: 1.3rem;
  margin-bottom: 16px;
}

.resultado-consulta {
  min-height: 40px;
}

.lista-agendamentos-cliente {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.agendamento-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  transition: all 0.2s ease;
}

.agendamento-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--secondary);
}

.agendamento-card strong {
  color: var(--text);
  font-size: 1.1rem;
  display: block;
  margin-bottom: 4px;
}

.agendamento-card small {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.btn-cancelar {
  background: var(--text-muted);
  color: white;
  white-space: nowrap;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s ease;
}

.btn-cancelar:hover {
  background: #ef4444;
}

/* Tabelas estilizadas */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

table th {
  background: var(--primary);
  color: white;
  padding: 12px;
  text-align: left;
  font-weight: 600;
}

table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

table tbody tr:hover {
  background: var(--bg);
}

/* Melhorias de layout */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .agendamento-card {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .agendamento-card button {
    width: 100%;
  }
}
