/* style.css - Folha de Estilo Premium e Responsiva para Oficina de Voz */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --bg-primary: #12181f;
  --bg-secondary: #1a232d;
  --bg-surface: #222d3a;
  --accent-color: #00e676; /* Verde Neon WhatsApp */
  --accent-hover: #00c853;
  --accent-glow: rgba(0, 230, 118, 0.3);
  --text-primary: #ffffff;
  --text-secondary: #90a4ae;
  --border-color: #2c3a4e;
  --danger-color: #ff5252;
  --warning-color: #ffd740;
  --success-color: #00e676;
  
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  --glass-bg: rgba(26, 35, 45, 0.8);
  --glass-border: rgba(255, 255, 255, 0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Outfit', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
  padding: 0;
}

/* Container do App - Força proporção de Celular */
#app-container {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  background-color: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

@media (min-width: 481px) {
  #app-container {
    height: 92vh;
    border-radius: 32px;
    border: 4px solid var(--border-color);
  }
}

/* Header */
header {
  padding: 16px 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  background: linear-gradient(135deg, var(--accent-color), #00b0ff);
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #12181f;
  font-size: 20px;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.brand-title h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.brand-title span {
  font-size: 11px;
  color: var(--accent-color);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.brand-title span::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background-color: var(--accent-color);
  border-radius: 50%;
  animation: pulse-dot 1.5s infinite;
}

/* Área de Conteúdo Principal */
main {
  flex: 1;
  overflow-y: auto;
  position: relative;
  padding-bottom: 80px; /* Espaço para a navegação inferior */
}

/* Telas / Abas */
.tab-content {
  display: none;
  height: 100%;
  animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
  display: block;
}

/* --- TELA 1: CHAT DE VOZ --- */
#voice-tab {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding: 20px;
}

#voice-tab.active {
  display: flex;
}

/* Histórico de Mensagens / Diálogo com Assistente */
.chat-container {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-right: 4px;
}

/* Estilo WhatsApp das bolhas */
.chat-bubble {
  max-width: 85%;
  padding: 14px 16px;
  border-radius: 20px;
  font-size: 15px;
  line-height: 1.4;
  position: relative;
  animation: slideInBubble 0.25s cubic-bezier(0.1, 0.8, 0.3, 1);
}

.chat-bubble.assistant {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-bubble.user {
  background-color: #075e54; /* Verde Escuro WhatsApp */
  color: var(--text-primary);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-bubble .time {
  font-size: 10px;
  color: var(--text-secondary);
  text-align: right;
  margin-top: 4px;
  display: block;
}

/* Painel Central do Microfone */
.voice-action-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-top: auto;
}

.voice-status {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
  min-height: 20px;
  text-align: center;
  transition: color 0.3s;
}

.voice-status.listening {
  color: var(--accent-color);
  animation: pulse-text 1.5s infinite;
}

/* Waveform Animada */
.waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 40px;
  opacity: 0;
  transition: opacity 0.3s;
}

.waveform.active {
  opacity: 1;
}

.wave-bar {
  width: 4px;
  height: 8px;
  background-color: var(--accent-color);
  border-radius: 2px;
  animation: bounce-wave 0.8s ease-in-out infinite alternate;
}

.wave-bar:nth-child(2) { animation-delay: 0.1s; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; }
.wave-bar:nth-child(4) { animation-delay: 0.3s; }
.wave-bar:nth-child(5) { animation-delay: 0.4s; }
.wave-bar:nth-child(6) { animation-delay: 0.3s; }
.wave-bar:nth-child(7) { animation-delay: 0.2s; }
.wave-bar:nth-child(8) { animation-delay: 0.1s; }

/* Botão de Microfone */
.mic-btn-container {
  position: relative;
  width: 90px;
  height: 90px;
}

.mic-btn {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-color), #00b0ff);
  border: none;
  outline: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #12181f;
  font-size: 32px;
  box-shadow: 0 8px 25px rgba(0, 230, 118, 0.4);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 2;
  position: relative;
}

.mic-btn:active {
  transform: scale(0.9);
}

.mic-btn.listening {
  background: var(--danger-color);
  color: white;
  box-shadow: 0 8px 30px rgba(255, 82, 82, 0.5);
}

.mic-btn-glow {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  background: var(--accent-glow);
  z-index: 1;
  transform: scale(1);
  opacity: 0;
  transition: all 0.3s;
}

.mic-btn.listening + .mic-btn-glow {
  animation: pulse-glow 1.5s infinite;
  background: rgba(255, 82, 82, 0.2);
}

/* Campo de Digitação Rápida/Colagem */
.quick-text-input-container {
  display: flex;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 4px;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  margin-top: 8px;
}

.quick-text-input-container input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: white;
  padding: 10px 12px;
  font-size: 14px;
}

.quick-text-input-container input::placeholder {
  color: var(--text-secondary);
}

#quick-text-send-btn {
  background: var(--accent-color);
  color: #12181f;
  border: none;
  outline: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.2s, transform 0.1s;
}

#quick-text-send-btn:active {
  transform: scale(0.95);
}

#quick-text-send-btn:hover {
  background: var(--accent-hover);
}

/* --- TELA 2: HISTÓRICO DE SERVIÇOS --- */
.tab-header {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tab-title h2 {
  font-size: 22px;
  font-weight: 700;
}

.tab-actions {
  display: flex;
  gap: 8px;
}

/* Painel de Resumo Financeiro Rápido */
.financial-summary {
  margin: 0 20px 20px 20px;
  padding: 16px;
  background: linear-gradient(135deg, var(--bg-surface), #2d3b4d);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.summary-card {
  display: flex;
  flex-direction: column;
}

.summary-card span {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-card strong {
  font-size: 18px;
  font-weight: 700;
  margin-top: 4px;
}

.summary-card.pago strong { color: var(--accent-color); }
.summary-card.pendente strong { color: var(--warning-color); }

/* Lista de Serviços */
.services-list {
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.service-card {
  background: var(--bg-surface);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  padding: 16px;
  position: relative;
  transition: transform 0.2s, border-color 0.2s;
}

.service-card:active {
  transform: scale(0.98);
}

.service-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.service-card-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.service-date {
  font-size: 12px;
  color: var(--text-secondary);
}

.service-items {
  font-size: 13px;
  color: var(--text-secondary);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding: 8px 0;
  margin-bottom: 12px;
}

.service-item-line {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.service-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.service-total {
  font-size: 16px;
  font-weight: 700;
}

.service-total span {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Badges e Status de Pagamento */
.status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 8px;
  text-transform: uppercase;
}

.status-badge.pago {
  background: rgba(0, 230, 118, 0.15);
  color: var(--accent-color);
}

.status-badge.pendente {
  background: rgba(255, 215, 64, 0.15);
  color: var(--warning-color);
}

/* Ações Rápidas do Card */
.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn-small {
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
}

.btn-small.primary {
  background: var(--accent-color);
  color: #12181f;
}

.btn-small.secondary {
  background: var(--border-color);
  color: var(--text-primary);
}

.btn-small.danger {
  background: rgba(255, 82, 82, 0.15);
  color: var(--danger-color);
}

/* --- TELA 3: AGENDA (CALENDÁRIO) --- */
.schedule-container {
  padding: 0 20px;
}

/* Layout de Agenda Simples */
.schedule-day-group {
  margin-bottom: 20px;
}

.schedule-day-title {
  font-size: 14px;
  color: var(--accent-color);
  font-weight: 600;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
}

.appointment-card {
  background: var(--bg-surface);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.appointment-info h4 {
  font-size: 15px;
  font-weight: 600;
}

.appointment-info p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.appointment-status {
  display: flex;
  align-items: center;
}

/* --- TELA 4: CONFIGURAÇÕES --- */
.settings-container {
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-group {
  background: var(--bg-surface);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  padding: 16px;
}

.settings-group h3 {
  font-size: 15px;
  color: var(--accent-color);
  margin-bottom: 14px;
  font-weight: 600;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  font-size: 12px;
  color: var(--text-secondary);
}

.form-group input, .form-group select {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: white;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  width: 100%;
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--accent-color);
}

/* Switch Toggle */
.switch-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.switch-label {
  display: flex;
  flex-direction: column;
}

.switch-label span {
  font-size: 14px;
  font-weight: 500;
}

.switch-label small {
  font-size: 11px;
  color: var(--text-secondary);
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-color);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

/* --- BARRA DE NAVEGAÇÃO INFERIOR --- */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 70px;
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 10;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-secondary);
  background: none;
  border: none;
  outline: none;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px;
  gap: 4px;
  transition: color 0.2s;
  flex: 1;
}

.nav-item.active {
  color: var(--accent-color);
}

.nav-item i {
  font-size: 20px;
}

/* --- MODAIS DE CADASTRO / EDIÇÃO --- */
.modal {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  justify-content: flex-end;
  flex-direction: column;
  animation: fadeIn 0.2s ease;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-surface);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  border-top: 1px solid var(--border-color);
  padding: 24px 20px;
  max-height: 85%;
  overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(0.1, 0.8, 0.3, 1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 22px;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.btn-large {
  flex: 1;
  padding: 14px;
  border-radius: 12px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.btn-large.primary {
  background: var(--accent-color);
  color: #12181f;
}

.btn-large.secondary {
  background: var(--border-color);
  color: var(--text-primary);
}

/* Itens dinâmicos no cadastro manual */
.manual-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.manual-item-row {
  display: flex;
  gap: 8px;
}

.btn-remove-item {
  background: none;
  border: none;
  color: var(--danger-color);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
}

/* Caixa de Confirmação Rápida de Voz (Popup) */
.voice-confirm-box {
  background: rgba(0, 230, 118, 0.1);
  border: 1px solid var(--accent-color);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  animation: slideInBubble 0.3s ease;
}

.voice-confirm-header {
  font-weight: 600;
  color: var(--accent-color);
  font-size: 14px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
}

.voice-confirm-details {
  font-size: 13px;
  margin-bottom: 12px;
}

.voice-confirm-details ul {
  list-style: none;
  margin-top: 4px;
  padding-left: 8px;
}

.voice-confirm-actions {
  display: flex;
  gap: 8px;
}

/* Estado de vazio (empty state) */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 14px;
}

/* Animações */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

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

@keyframes pulse-dot {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

@keyframes pulse-text {
  0% { opacity: 0.7; }
  50% { opacity: 1; }
  100% { opacity: 0.7; }
}

@keyframes pulse-glow {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.4); opacity: 0; }
}

@keyframes bounce-wave {
  0% { height: 8px; }
  100% { height: 35px; }
}
