/* Reset básico */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Variáveis CSS (design system) - Light Theme */
:root, [data-theme="light"] {
  /* Cores primárias - Rosa mais suave */
  --primary-color: #c084fc; /* Roxo/lilás suave */
  --primary-hover: #a855f7;
  --primary-dark: #9333ea;
  --secondary-color: #f472b6; /* Rosa suave */
  --accent-color: #60a5fa; /* Azul suave para contraste */
  
  /* Backgrounds */
  --background: #faf5ff; /* Roxo muito claro */
  --background-alt: #f3e8ff;
  --surface: #ffffff;
  --surface-hover: #faf5ff;
  --card-background: #ffffff;
  
  /* Textos */
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  
  /* Bordas e sombras */
  --border: #e5e7eb;
  --border-hover: #c084fc;
  --shadow: rgba(192, 132, 252, 0.1);
  --shadow-hover: rgba(192, 132, 252, 0.2);
  
  /* Estados */
  --error: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --info: #3b82f6;
}

/* Dark Theme */
[data-theme="dark"] {
  /* Cores primárias - Ajustadas para dark */
  --primary-color: #a78bfa;
  --primary-hover: #8b5cf6;
  --primary-dark: #7c3aed;
  --secondary-color: #f472b6;
  --accent-color: #60a5fa;
  
  /* Backgrounds */
  --background: #0f0a1a; /* Roxo muito escuro */
  --background-alt: #1a1229;
  --surface: #1f1833;
  --surface-hover: #2a2341;
  --card-background: #1f1833;
  
  /* Textos */
  --text-primary: #f3f4f6;
  --text-secondary: #d1d5db;
  --text-tertiary: #9ca3af;
  
  /* Bordas e sombras */
  --border: #374151;
  --border-hover: #a78bfa;
  --shadow: rgba(167, 139, 250, 0.15);
  --shadow-hover: rgba(167, 139, 250, 0.25);
  
  /* Estados */
  --error: #f87171;
  --success: #34d399;
  --warning: #fbbf24;
  --info: #60a5fa;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  background: var(--background);
  min-height: 100vh;
  color: var(--text-primary);
  transition: background 0.3s ease, color 0.3s ease;
}

/* Gradiente de fundo para light theme */
[data-theme="light"] body {
  background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
}

/* Gradiente de fundo para dark theme */
[data-theme="dark"] body {
  background: linear-gradient(135deg, #0f0a1a 0%, #1a1229 100%);
}

/* Mensagens de feedback */
.messages {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  max-width: 400px;
}

.message {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 10px;
  animation: slideIn 0.3s ease-out;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.message.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
  border-left: 4px solid var(--error);
}

.message.success {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
  border-left: 4px solid var(--success);
}

.message.info {
  background: #dbeafe;
  color: #3b82f6;
  border-left: 4px solid #3b82f6;
}

/* Botões */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
  display: inline-block;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px var(--shadow);
}

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

.btn-secondary:hover {
  background: var(--primary-color);
  color: var(--card-background);
}

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

.btn-danger:hover {
  background: var(--error);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(239, 68, 68, 0.3);
}

/* Inputs e Forms */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="url"],
input[type="tel"],
textarea,
select,
.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text-primary);
  transition: all 0.3s ease;
  box-sizing: border-box;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="tel"]:focus,
textarea:focus,
select:focus,
.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--shadow);
  background: var(--surface);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-tertiary);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 14px;
}

/* Responsividade Mobile */
@media (max-width: 768px) {
  /* Mensagens */
  .messages {
    right: 10px;
    left: 10px;
    top: 10px;
    max-width: none;
  }

  .message {
    font-size: 13px;
    padding: 10px 12px;
  }

  /* Botões */
  .btn {
    padding: 10px 20px;
    font-size: 14px;
    width: 100%;
    text-align: center;
  }

  /* Layout geral */
  body {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .btn {
    padding: 12px 16px;
    font-size: 14px;
  }
}

/* Estilos para modal de notas com humores e sintomas */
.modal-content-large {
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  padding-bottom: 120px; /* Espaço extra para os botões em telas pequenas */
}

/* Garante que o modal fique acima do menu inferior */
#moodModal {
  z-index: 1100 !important;
}

.form-section {
  margin-bottom: 25px;
}

/* Cabeçalho expansível das seções */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 14px 16px;
  margin: 0 -16px;
  background: var(--secondary-bg);
  border-radius: 8px;
  transition: all 0.2s ease;
  user-select: none;
}

.section-header:hover {
  background: var(--border);
  transform: translateX(2px);
}

.section-label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0;
  flex: 1;
}

.toggle-icon {
  font-size: 16px;
  font-weight: bold;
  color: var(--primary-color);
  transition: transform 0.3s ease;
  user-select: none;
  margin-left: 12px;
}

.toggle-icon.collapsed {
  transform: rotate(-90deg);
}

/* Seções colapsáveis */
.checkbox-grid.collapsed {
  display: none !important;
}

.checkbox-grid {
  display: grid;
  margin-top: 15px;
}

/* Grid de checkboxes */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--surface);
  user-select: none;
  min-height: 48px;
}

.checkbox-item:hover {
  border-color: var(--primary-color);
  background: linear-gradient(
    135deg,
    var(--primary-color) 05,
    var(--primary-color) 10
  );
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(217, 70, 239, 0.1);
}

.checkbox-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-right: 10px;
  cursor: pointer;
  accent-color: var(--primary-color);
  flex-shrink: 0;
}

.checkbox-item input[type="checkbox"]:checked ~ .checkbox-label {
  color: var(--primary-color);
  font-weight: 600;
}

.checkbox-item:has(input:checked) {
  border-color: var(--primary-color);
  background: linear-gradient(
    135deg,
    var(--primary-color) 10,
    var(--primary-color) 20
  );
  box-shadow: 0 2px 12px rgba(217, 70, 239, 0.15);
}

.checkbox-label {
  font-size: 14px;
  color: var(--text-primary);
  transition: all 0.2s ease;
  line-height: 1.4;
  flex: 1;
}

/* Radio buttons para fluxo */
.radio-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.radio-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--surface);
  user-select: none;
  min-height: 52px;
}

.radio-item:hover {
  border-color: #ef4444;
  background: linear-gradient(135deg, #ef444405, #ef444410);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.1);
}

.radio-item input[type="radio"] {
  width: 20px;
  height: 20px;
  margin-right: 12px;
  cursor: pointer;
  accent-color: #ef4444;
  flex-shrink: 0;
}

.radio-item input[type="radio"]:checked ~ .radio-label {
  color: #ef4444;
  font-weight: 600;
}

.radio-item:has(input:checked) {
  border-color: #ef4444;
  background: linear-gradient(135deg, #ef444410, #ef444420);
  box-shadow: 0 2px 12px rgba(239, 68, 68, 0.15);
}

.radio-label {
  font-size: 14px;
  color: var(--text-primary);
  transition: all 0.2s ease;
  line-height: 1.4;
  flex: 1;
}

/* Responsive */
@media (max-width: 768px) {
  .modal-content-large {
    max-width: 95%;
    max-height: 80vh; /* Reduz altura em mobile para garantir espaço */
    padding: 20px;
    padding-bottom: 140px; /* Espaço extra para botões + menu inferior */
    margin-bottom: 0;
  }

  .checkbox-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .radio-group {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .checkbox-item,
  .radio-item {
    padding: 10px 12px;
    min-height: 44px;
  }

  .checkbox-label,
  .radio-label {
    font-size: 13px;
  }

  /* Garante que os botões do modal sejam visíveis */
  #moodModal .modal-content-large {
    position: relative;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .checkbox-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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