/* ==========================================================================
   CSS GLOBAL & VARIÁVEIS (DESIGN SYSTEM PREMIUM)
   ========================================================================== */
:root {
  /* Dark theme (default) */
  --bg-primary: #0d0d0d;
  --bg-secondary: #171717;
  --bg-tertiary: #212121;
  --bg-accent: #2f2f2f;
  
  --text-primary: #ececec;
  --text-secondary: #b4b4b4;
  --text-muted: #9e9e9e;
  
  --brand-green: #10a37f;
  --brand-green-hover: #1a7f64;
  --brand-glow: rgba(16, 163, 127, 0.15);
  
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.1);
  --success: #22c55e;
  
  --border-light: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(16, 163, 127, 0.4);
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Outfit', var(--font-sans);
  
  --sidebar-width: 280px;
  --header-height: 56px;
  --max-chat-width: 768px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 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.3), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* LIGHT THEME */
[data-theme="light"] {
  --bg-primary: #f5f5f5;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e8e8e8;
  --bg-accent: #dcdcdc;
  --bg-input: #ffffff;
  
  --text-primary: #1a1a1a;
  --text-secondary: #4a4a4a;
  --text-muted: #7a7a7a;
  
  --brand-green: #10a37f;
  --brand-green-hover: #0d8f6f;
  --brand-glow: rgba(16, 163, 127, 0.1);
  
  --border-light: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(16, 163, 127, 0.4);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 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.15), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Ajustes de contraste para o cabeçalho no modo claro */
[data-theme="light"] .chat-header {
  background-color: rgba(245, 245, 245, 0.8) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] .chat-header .btn-menu,
[data-theme="light"] .chat-header .btn-theme-toggle,
[data-theme="light"] .chat-header .btn-new-chat-mobile {
  color: var(--text-primary) !important; /* #1a1a1a - Máximo contraste no fundo claro */
}

[data-theme="light"] .chat-header .btn-menu:hover,
[data-theme="light"] .chat-header .btn-theme-toggle:hover,
[data-theme="light"] .chat-header .btn-new-chat-mobile:hover {
  background-color: rgba(0, 0, 0, 0.06) !important;
}

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

html {
  height: -webkit-fill-available;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  height: -webkit-fill-available;
  height: 100%;
  height: 100dvh;
  width: 100%;
}

/* ==========================================================================
   TELA DE LOGIN
   ========================================================================== */
.login-body {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #080808;
  position: relative;
  overflow: hidden;
}

.login-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(16, 163, 127, 0.12) 0%, rgba(0,0,0,0) 70%);
  z-index: 1;
  pointer-events: none;
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: 24px;
  z-index: 2;
}

.login-card {
  background: rgba(23, 23, 23, 0.65);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  padding: 40px 32px;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  gap: 32px;
  transform: translateY(0);
  transition: transform var(--transition-slow), border-color var(--transition-normal);
}

.login-card:hover {
  border-color: rgba(16, 163, 127, 0.2);
}

.login-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.logo-orb {
  width: 64px;
  height: 64px;
  background: radial-gradient(135deg, var(--brand-green) 0%, #0c7359 100%);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 0 20px rgba(16, 163, 127, 0.4);
  margin-bottom: 8px;
}

.logo-inner {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  -webkit-user-select: none;
  user-select: none;
}

.login-header h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.input-group label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper input {
  width: 100%;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 14px 16px;
  padding-right: 48px;
  color: var(--text-primary);
  font-size: 16px;
  outline: none;
  font-family: var(--font-sans);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-wrapper input:focus {
  border-color: var(--brand-green);
  box-shadow: 0 0 0 2px var(--brand-glow);
}

.toggle-password {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 4px;
  transition: color var(--transition-fast);
}

.toggle-password:hover {
  color: var(--text-primary);
}

.toggle-password svg {
  width: 20px;
  height: 20px;
}

.error-message {
  font-size: 13px;
  color: #f87171;
  background-color: var(--error-bg);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  padding: 10px 14px;
  display: none;
  animation: fadeIn var(--transition-fast);
}

.error-message.visible {
  display: block;
}

.btn-submit {
  background-color: var(--brand-green);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  padding: 14px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(16, 163, 127, 0.2);
  transition: background-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-submit:hover:not(:disabled) {
  background-color: var(--brand-green-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 163, 127, 0.3);
}

.btn-submit:active:not(:disabled) {
  transform: translateY(0);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.arrow-icon {
  width: 18px;
  height: 18px;
  transition: transform var(--transition-fast);
}

.btn-submit:hover:not(:disabled) .arrow-icon {
  transform: translateX(3px);
}

/* Animações Login */
.shake {
  animation: shakeAnimation 0.5s ease-in-out;
}

@keyframes shakeAnimation {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

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

/* ==========================================================================
   INTERFÁCIL PRINCIPAL - LAYOUT
   ========================================================================== */
.app-container {
  display: flex;
  width: 100%;
  height: 100%;
  height: -webkit-fill-available;
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

/* Menu Lateral / Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  height: 100%;
  z-index: 10;
  flex-shrink: 0;
  transition: transform var(--transition-slow);
}

.sidebar-header {
  padding: 16px;
  padding-top: calc(16px + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-light);
}

.btn-new-chat {
  flex: 1;
  background-color: transparent;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.btn-new-chat:hover {
  background-color: var(--bg-accent);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-new-chat svg {
  width: 16px;
  height: 16px;
}

.btn-close-sidebar {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: none; /* Apenas no mobile */
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.btn-close-sidebar:hover {
  background-color: var(--bg-accent);
  color: var(--text-primary);
}

.btn-close-sidebar svg {
  width: 20px;
  height: 20px;
}

/* Histórico de Chat */
.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chat-history::-webkit-scrollbar {
  width: 4px;
}

.chat-history::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
}

.chat-history::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

/* Busca no Histórico */
.sidebar-search {
  padding: 12px 16px 0;
}

.sidebar-search-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 8px 12px;
  transition: border-color var(--transition-fast);
}

.sidebar-search-wrapper:focus-within {
  border-color: var(--border-focus);
}

.search-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-sans);
  min-width: 0;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.search-clear:hover {
  color: var(--text-primary);
  background-color: rgba(255,255,255,0.05);
}

.search-clear svg {
  width: 14px;
  height: 14px;
}

/* Tags de filtro */
.sidebar-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px 0;
}

.tag-filter {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
}

.tag-filter:hover {
  background-color: var(--bg-accent);
  color: var(--text-primary);
}

.tag-filter.active {
  background-color: var(--brand-green);
  border-color: var(--brand-green);
  color: white;
}

/* Busca results header */
.search-results-header {
  padding-bottom: 8px;
}

.search-results-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.search-clear-all {
  background: none;
  border: none;
  color: var(--brand-green);
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font-sans);
  padding: 2px 6px;
  border-radius: 4px;
  transition: background-color var(--transition-fast);
}

.search-clear-all:hover {
  background-color: var(--brand-glow);
}

.history-group h3 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-left: 8px;
}

.history-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 13.5px;
  gap: 8px;
  text-decoration: none;
  position: relative;
  transition: background-color var(--transition-fast);
}

.history-item:hover {
  background-color: var(--bg-tertiary);
}

.history-item.active {
  background-color: var(--bg-accent);
  font-weight: 500;
}

.history-item.pinned {
  border-left: 2px solid var(--brand-green);
  padding-left: 8px;
}

.history-item-content {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.history-item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.pin-icon {
  width: 12px;
  height: 12px;
  color: var(--brand-green);
  flex-shrink: 0;
}

.history-item-tags {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.history-tag-badge {
  font-size: 10px;
}

.history-item-actions {
  display: none;
  align-items: center;
  gap: 4px;
}

.history-item:hover .history-item-actions {
  display: flex;
}

.btn-history-action {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.btn-history-action:hover {
  color: var(--text-primary);
  background-color: rgba(255,255,255,0.05);
}

.btn-history-action svg {
  width: 14px;
  height: 14px;
}

/* Rodapé Sidebar */
.sidebar-footer {
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-light);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px;
  border-radius: 12px;
  position: relative;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 600;
  font-size: 14px;
  color: white;
  -webkit-user-select: none;
  user-select: none;
  flex-shrink: 0;
}

.user-avatar {
  background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
}

.bot-avatar {
  background: radial-gradient(135deg, var(--brand-green) 0%, #0a5f49 100%);
}

.user-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-status {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-logout {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.btn-logout:hover {
  color: var(--error);
  background-color: rgba(239, 68, 68, 0.05);
}

.btn-logout svg {
  width: 18px;
  height: 18px;
}

/* Overlay da Sidebar no Mobile */
.sidebar-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 9;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

/* ==========================================================================
   ÁREA DE CONVERSA PRINCIPAL
   ========================================================================== */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--bg-primary);
  position: relative;
  min-width: 0;
}

/* Header */
.chat-header {
  height: auto;
  min-height: var(--header-height);
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
  background-color: rgba(13, 13, 13, 0.8);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 8;
}

.btn-menu {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: none; /* Oculto por padrão no desktop */
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

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

.btn-menu svg {
  width: 20px;
  height: 20px;
}

.model-badge {
  display: none !important; /* Oculto conforme solicitação do usuário */
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.model-badge:hover {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.model-badge svg.chevron {
  width: 14px;
  height: 14px;
}

.btn-new-chat-mobile {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: none; /* Apenas no mobile */
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.btn-new-chat-mobile:hover {
  color: var(--text-primary);
  background-color: var(--bg-secondary);
}

.btn-new-chat-mobile svg {
  width: 20px;
  height: 20px;
}

/* Container de Mensagens */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
}

.messages-container::-webkit-scrollbar {
  width: 6px;
}

.messages-container::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

/* Tela de Boas-Vindas */
.welcome-container {
  max-width: 580px;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 24px;
  padding: 40px 16px;
}

.welcome-logo {
  margin-bottom: 8px;
}

.welcome-logo .logo-outer {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: radial-gradient(135deg, var(--brand-green) 0%, #0a5f49 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 0 16px var(--brand-glow);
}

.welcome-logo .logo-inner {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: white;
}

.welcome-container h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
}

.suggestions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
  margin-top: 16px;
}

.suggestion-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.suggestion-card:hover {
  background-color: var(--bg-tertiary);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.suggestion-card h4 {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
}

.suggestion-card p {
  font-size: 12px;
  color: var(--text-muted);
}

/* Lista de Conversa */
.conversation-list {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--max-chat-width);
  margin: 0 auto;
}

.message-row {
  display: flex;
  gap: 16px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border-light);
  animation: fadeInUp var(--transition-normal);
}

.message-icon {
  flex-shrink: 0;
}

.message-content {
  flex: 1;
  overflow-x: auto;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.message-content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

/* Ações de mensagem (copiar, ouvir, etc) */
.message-actions {
  display: flex;
  gap: 4px;
  opacity: 0.4;
  transition: opacity var(--transition-fast);
  margin-top: 4px;
}

.message-row:hover .message-actions,
.message-actions:focus-within {
  opacity: 1;
}

@media (max-width: 768px) {
  .message-actions {
    opacity: 0.8;
  }
}

.msg-action-btn {
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
}

.msg-action-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.15);
}

.msg-action-btn svg {
  width: 14px;
  height: 14px;
}

.message-content p {
  margin-bottom: 12px;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content h1, .message-content h2, .message-content h3 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 16px 0 8px 0;
  color: var(--text-primary);
}

.message-content h1 { font-size: 20px; }
.message-content h2 { font-size: 18px; }
.message-content h3 { font-size: 16px; }

.message-content ul, .message-content ol {
  margin-bottom: 12px;
  padding-left: 20px;
}

.message-content li {
  margin-bottom: 4px;
}

/* Bloco de Código Markdown */
.code-container {
  background-color: #1e1e1e;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  margin: 16px 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.code-header {
  background-color: #2d2d2d;
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
}

.code-lang {
  font-family: monospace;
  text-transform: lowercase;
  font-weight: 600;
}

.btn-copy-code {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.btn-copy-code:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.05);
}

.btn-copy-code svg {
  width: 14px;
  height: 14px;
}

.code-container pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
}

.code-container code {
  font-family: 'Fira Code', 'Courier New', Courier, monospace;
  font-size: 13.5px;
  background: none;
  padding: 0;
  border-radius: 0;
}

/* Código inline */
code {
  font-family: monospace;
  font-size: 14px;
  background-color: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Cursor de digitação (Streaming) */
.typing-cursor {
  display: inline-block;
  width: 8px;
  height: 15px;
  background-color: var(--text-primary);
  margin-left: 2px;
  vertical-align: middle;
  animation: blink 0.8s step-end infinite;
}

/* Rodapé / Input Area */
.chat-footer {
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  background-color: var(--bg-primary);
}

.input-container {
  max-width: var(--max-chat-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-box {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 10px 14px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-box:focus-within {
  border-color: var(--border-focus);
}

.input-box textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  resize: none;
  max-height: 200px;
  padding: 6px 0;
  line-height: 1.4;
}

.input-box button[type="submit"] {
  background-color: var(--text-primary);
  color: var(--bg-primary);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color var(--transition-fast), opacity var(--transition-fast), transform var(--transition-fast);
}

.input-box button[type="submit"]:hover:not(:disabled) {
  transform: scale(1.05);
}

.input-box button[type="submit"]:disabled {
  opacity: 0.2;
  cursor: not-allowed;
  background-color: var(--bg-accent);
  color: var(--text-muted);
}

.input-box button[type="submit"] svg {
  width: 16px;
  height: 16px;
}

/* Botão de voz (microfone) */
.btn-voice {
  background: none !important;
  border: none !important;
  color: var(--text-secondary, #a3a3a3) !important;
  border-radius: 50% !important;
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: color var(--transition-fast), background-color var(--transition-fast), transform var(--transition-fast);
  padding: 0 !important;
}

.btn-voice svg {
  width: 20px;
  height: 20px;
}

.btn-voice:hover {
  color: var(--brand-green, #10a37f) !important;
  background-color: rgba(16, 163, 127, 0.1) !important;
  transform: scale(1.1);
}

.btn-voice.listening {
  color: #ef4444 !important;
  background-color: rgba(239, 68, 68, 0.12) !important;
  animation: pulse-voice 1.5s ease-in-out infinite;
}

@keyframes pulse-voice {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.8; }
}

/* Botão regenerar */
.msg-action-btn.btn-regenerate:hover {
  color: #10b981 !important;
}

.msg-action-btn.btn-regenerate:hover svg {
  transform: rotate(-30deg);
}

.msg-action-btn.btn-regenerate svg {
  transition: transform 0.3s ease;
}

/* Botão editar */
.msg-action-btn.btn-edit:hover {
  color: #8b5cf6 !important;
}

.msg-action-btn.btn-edit:hover svg {
  transform: scale(1.1);
}

.msg-action-btn.btn-edit svg {
  transition: transform 0.2s ease;
}

/* Botão de anexar */
.btn-attach {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-attach svg {
  width: 20px;
  height: 20px;
}

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

.btn-attach.has-files {
  color: var(--accent);
}

/* Preview de anexos na barra de input */
.attachments-preview {
  display: flex;
  gap: 6px;
  padding: 6px 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border-color);
  min-height: 0;
}

.attachment-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 4px;
  background: var(--hover-bg);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-color);
  border: 1px solid var(--border-color);
  max-width: 150px;
}

.attachment-item img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.attachment-item .file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 90px;
}

.attachment-item .remove-attachment {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ef4444;
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
}

.msg-action-btn.btn-speak svg {
  transition: transform 0.2s ease;
}

.msg-action-btn.btn-speak:hover {
  color: #8b5cf6 !important;
}

.msg-action-btn.btn-speak:hover svg {
  transform: scale(1.1);
}

.msg-action-btn.btn-speak.speaking {
  color: #8b5cf6 !important;
  animation: pulse-speak 1.5s ease-in-out infinite;
}

@keyframes pulse-speak {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* ==========================================================================
   ANIMAÇÕES
   ========================================================================== */
@keyframes blink {
  from, to { background-color: transparent }
  50% { background-color: var(--text-primary) }
}

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

/* ==========================================================================
   MEDIA QUERIES (RESPONSIVIDADE MOBILE-FIRST)
   ========================================================================== */
@media (max-width: 768px) {
  .btn-menu {
    display: flex;
  }
  /* No Mobile, a Sidebar fica escondida por padrão e abre em overlay */
  .sidebar {
    position: absolute;
    top: 0;
    left: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-xl);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .sidebar.open + .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }
  
  .btn-close-sidebar {
    display: flex;
  }
  
  .btn-new-chat-mobile {
    display: flex;
  }
  
  .suggestions-grid {
    grid-template-columns: 1fr;
  }
  
  .messages-container {
    padding: 16px 12px;
  }
  
  .message-row {
    padding: 16px 0;
  }
  
  .message-content {
    font-size: 14.5px;
  }
  
  .welcome-container h2 {
    font-size: 20px;
  }

  /* Ajustes para modais no mobile para evitar overflow e corte de conteúdo */
  .settings-modal-content {
    width: 95% !important;
    max-height: 92dvh !important;
    height: auto !important;
  }

  /* Modal de Emitir Relatório */
  #emitirRelatorioModal .settings-modal-body {
    overflow-y: auto !important; /* Permite rolar todo o corpo do modal no mobile */
    max-height: calc(92dvh - 60px) !important; /* Garante que o body não passe do modal content */
    display: flex !important;
    flex-direction: column !important;
  }

  /* Ajustar filtros no mobile para não ocupar muito espaço horizontal mas quebrar bem */
  #emitirRelatorioModal .settings-modal-body > div:first-child {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important;
  }

  /* O visualizador do relatório no mobile precisa de uma altura definida para não colapsar */
  #emitirRelatorioModal .settings-modal-body > div:last-child {
    flex: none !important;
    height: 420px !important; /* Altura fixa garantida no mobile */
    min-height: 420px !important;
    display: flex !important;
    flex-direction: column !important;
  }
  
  /* Garantir que a área de preview interna também role */
  #emitirReportPreviewArea {
    flex: 1 !important;
    overflow-y: auto !important;
  }
  
  /* Ajustes para o modal de Modelos de Relatório */
  #modelosRelatorioModal .settings-modal-body {
    overflow-y: auto !important;
    flex-direction: column !important; /* Em vez de row (lado a lado), fica coluna */
    max-height: calc(92dvh - 60px) !important;
    min-height: auto !important;
  }
  
  #modelosRelatorioModal .settings-modal-body > div:first-child {
    border-right: none !important;
    border-bottom: 1px solid var(--border-light);
    padding-right: 0 !important;
    padding-bottom: 16px !important;
  }
  
  #minhaTurmaModal .settings-modal-body {
    overflow-y: auto !important;
    flex: none !important;
    min-height: auto !important;
    max-height: calc(92dvh - 120px) !important;
  }
  
  #turmaConfigSection, #turmaAlunosSection {
    flex-direction: column !important;
    overflow-y: visible !important;
    height: auto !important;
  }
  
  #turmaConfigSection > div, #turmaAlunosSection > div {
    border-right: none !important;
    border-bottom: 1px solid var(--border-light) !important;
    padding-right: 0 !important;
    padding-bottom: 16px !important;
    flex: none !important;
    height: auto !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  
  #turmaConfigSection > div:last-child, #turmaAlunosSection > div:last-child {
    border-bottom: none !important;
    padding-bottom: 0 !important;
    padding-left: 0 !important;
  }
  
  #turmaConfigSection select, #turmaConfigSection input,
  #turmaAlunosSection select, #turmaAlunosSection input {
    width: 100% !important;
  }

  .comics-project-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }
  
  .comics-project-row select,
  .comics-project-row input,
  .comics-project-row button {
    width: 100% !important;
    margin: 0 !important;
  }

  .cartaz-preview-panel {
    min-width: 0 !important;
    width: 100% !important;
    flex: none !important;
  }
  
  #cartazLeftConfigPanel, #cartazLeftCanvasPanel {
    min-width: 0 !important;
    width: 100% !important;
    padding-right: 0 !important;
    flex: none !important;
  }
  
  .cartaz-header-container {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }
  
  .cartaz-header-actions {
    flex-wrap: wrap !important;
    width: 100% !important;
    justify-content: flex-start !important;
  }
  
  .cartaz-header-actions button {
    flex: 1 1 auto !important;
    text-align: center !important;
  }

  #modelosRelatorioModal .settings-modal-body > div:last-child {
    padding-left: 0 !important;
    padding-top: 16px !important;
  }
}

@media (min-width: 769px) {
  /* Em desktop, mantemos o botão menu invisível ou esconde a sidebar sutilmente */
  /* Caso queira ocultar a sidebar no desktop, podemos controlar com a classe .sidebar-collapsed no container */
  .app-container.sidebar-collapsed .sidebar {
    display: none;
  }
}

/* ==========================================================================
   ESTILOS DE AVATARES COM FOTO (MINIMALISTAS E ELEGANTES)
   ========================================================================== */
.avatar-profile-wrapper {
  position: relative;
  width: 110px;
  height: 110px;
  margin-bottom: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.avatar-profile-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(16, 163, 127, 0.4);
  box-shadow: 0 0 20px rgba(16, 163, 127, 0.2);
  z-index: 2;
  transition: transform var(--transition-normal), border-color var(--transition-normal);
}

.avatar-profile-wrapper:hover .avatar-profile-img {
  transform: scale(1.04);
  border-color: var(--brand-green);
  box-shadow: 0 0 25px rgba(16, 163, 127, 0.45);
}

.avatar-profile-pulse {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1.5px solid var(--brand-green);
  opacity: 0.7;
  z-index: 1;
  animation: pulseGlow 3s cubic-bezier(0.24, 0, 0.38, 1) infinite;
  pointer-events: none;
}

@keyframes pulseGlow {
  0% {
    transform: scale(0.96);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.15);
    opacity: 0;
  }
  100% {
    transform: scale(0.96);
    opacity: 0;
  }
}

/* Sidebar Avatar */
.sidebar-avatar-wrapper {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Welcome Logo Avatar */
.welcome-avatar-wrapper {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(16, 163, 127, 0.3);
  box-shadow: 0 0 20px var(--brand-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-normal);
}

.welcome-avatar-wrapper:hover {
  transform: scale(1.05);
  border-color: var(--brand-green);
}

.welcome-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Chat Message Bot Avatar */
.bot-avatar-img-wrapper {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid rgba(16, 163, 127, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bot-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Rename Input Inline */
.rename-input {
  background-color: var(--bg-tertiary) !important;
  border: 1px solid var(--border-focus) !important;
  border-radius: 6px !important;
  color: var(--text-primary) !important;
  font-size: 13px !important;
  font-family: var(--font-sans) !important;
  padding: 4px 6px !important;
  width: 100% !important;
  outline: none !important;
  box-shadow: 0 0 5px var(--brand-glow) !important;
}

/* ==========================================================================
   THEME TOGGLE BUTTON
   ========================================================================== */
.btn-theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  color: var(--text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-theme-toggle:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-theme-toggle svg {
  width: 20px;
  height: 20px;
}

/* Theme toggle in header - right side */
.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   MODAL DE TAGS (substitui prompt())
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-tag {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 24px;
  min-width: 320px;
  max-width: 90vw;
  box-shadow: var(--shadow-xl);
  transform: scale(0.9) translateY(20px);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-tag {
  transform: scale(1) translateY(0);
}

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

.modal-tag-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-tag-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  color: var(--text-muted);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.modal-tag-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.modal-tag-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.modal-tag-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: background var(--transition-fast);
  border: 1px solid transparent;
}

.modal-tag-item:hover {
  background: var(--bg-tertiary);
}

.modal-tag-item.selected {
  background: var(--brand-glow);
  border-color: var(--brand-green);
}

.modal-tag-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-green);
  cursor: pointer;
}

.modal-tag-item span {
  font-size: 14px;
  color: var(--text-primary);
}

.modal-tag-item.selected span {
  color: var(--brand-green);
  font-weight: 500;
}

.modal-tag-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

.modal-tag-btn {
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
  border: none;
}

.modal-tag-btn:active {
  transform: scale(0.97);
}

.modal-tag-btn.primary {
  background: var(--brand-green);
  color: white;
}

.modal-tag-btn.primary:hover {
  background: var(--brand-green-hover);
}

.modal-tag-btn.secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.modal-tag-btn.secondary:hover {
  background: var(--bg-accent);
  color: var(--text-primary);
}

/* ==========================================================================
   TAG INPUT DISPLAY
   ========================================================================== */
.tags-display {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding: 10px;
  background: var(--bg-tertiary);
  border-radius: 10px;
  min-height: 44px;
  align-items: center;
}

.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  background: var(--brand-glow);
  color: var(--brand-green);
  border: 1px solid rgba(16, 163, 127, 0.3);
}

.tag-badge button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  color: var(--brand-green);
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.tag-badge button:hover {
  opacity: 1;
}

.no-tags {
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
}

/* ==========================================================================
   WELCOME CARDS (tematicos)
   ========================================================================== */
.welcome-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 600px;
  margin-top: 20px;
}

@media (max-width: 500px) {
  .welcome-grid {
    grid-template-columns: 1fr;
  }
}

.suggestion-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suggestion-card:hover {
  background: var(--bg-tertiary);
  border-color: var(--brand-green);
  transform: translateY(-2px);
}

.suggestion-card .card-icon {
  font-size: 24px;
  line-height: 1;
}

.suggestion-card .card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.suggestion-card .card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ==========================================================================
   SMART ROUTER MEDIA GENERATION (Imagem, Áudio e Vídeo)
   ========================================================================== */
.media-message-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 16px;
  margin: 12px 0;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  animation: fadeIn 0.3s ease-out;
}

.media-img-container, .media-video-container {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  justify-content: center;
  align-items: center;
  aspect-ratio: 1/1;
}

.media-video-container {
  aspect-ratio: 16/9;
}

.generated-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  transition: transform var(--transition-normal);
}

.generated-image:hover {
  transform: scale(1.02);
}

.generated-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 12px;
}

.media-caption {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.4;
  margin: 0;
  padding: 0 4px;
}

.media-actions-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.media-download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--brand-green) 0%, #1e7e4a 100%);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  flex: 1;
  box-shadow: 0 2px 8px rgba(30, 190, 110, 0.2);
}

.media-download-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.media-download-btn:active {
  transform: translateY(0);
}

.media-download-btn svg {
  width: 16px;
  height: 16px;
}

/* Player de Áudio Customizado */
.custom-audio-player {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.audio-play-btn {
  background: var(--brand-green);
  border: none;
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.audio-play-btn:hover {
  transform: scale(1.05);
}

.audio-play-btn svg {
  width: 18px;
  height: 18px;
}

.audio-play-btn svg.hidden {
  display: none;
}

.audio-timeline-container {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  position: relative;
  cursor: pointer;
}

.audio-timeline {
  width: 100%;
  height: 100%;
}

.audio-progress {
  height: 100%;
  background: var(--brand-green);
  border-radius: 3px;
  width: 0%;
  transition: width 0.1s linear;
}

.audio-time {
  font-size: 12px;
  color: var(--text-muted);
  font-family: monospace;
  min-width: 32px;
  text-align: right;
}

/* Loading de Mídia */
.media-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 12px;
  text-align: center;
}

.media-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(30, 190, 110, 0.1);
  border-radius: 50%;
  border-top-color: var(--brand-green);
  animation: spin 1s ease-in-out infinite;
}

.media-loading-text {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0;
  font-weight: 500;
}

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

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

/* ==========================================================================
   BARRA DE MODOS DE PROMPT RÁPIDOS (RODAPÉ DO INPUT)
   ========================================================================== */
.prompt-modes-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  padding: 4px 2px;
  justify-content: center;
}

.prompt-modes-bar::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.btn-prompt-mode {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 6px 14px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast) cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  font-family: var(--font-sans);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-prompt-mode:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  background-color: var(--bg-tertiary);
}

.btn-prompt-mode:active {
  transform: translateY(0);
}

.btn-prompt-mode .mode-icon {
  font-size: 14px;
}

/* Modo Música: Estilos e Cores (Roxo/Violeta) */
.btn-prompt-mode.mode-music {
  border-color: rgba(168, 85, 247, 0.4);
  color: #c084fc;
  background-color: rgba(168, 85, 247, 0.05);
}
.btn-prompt-mode.mode-music:hover {
  border-color: rgb(168, 85, 247);
  background-color: rgba(168, 85, 247, 0.1);
  color: #d8b4fe;
}

/* Modo Vídeo: Estilos e Cores (Azul/Ciano) */
.btn-prompt-mode.mode-video {
  border-color: rgba(6, 182, 212, 0.4);
  color: #22d3ee;
  background-color: rgba(6, 182, 212, 0.05);
}
.btn-prompt-mode.mode-video:hover {
  border-color: rgb(6, 182, 212);
  background-color: rgba(6, 182, 212, 0.1);
  color: #67e8f9;
}

/* Modo Imagem: Estilos e Cores (Laranja/Rosa) */
.btn-prompt-mode.mode-image {
  border-color: rgba(249, 115, 22, 0.4);
  color: #fb923c;
  background-color: rgba(249, 115, 22, 0.05);
}
.btn-prompt-mode.mode-image:hover {
  border-color: rgb(249, 115, 22);
  background-color: rgba(249, 115, 22, 0.1);
  color: #fdba74;
}

/* Modo Texto/História: Estilos e Cores (Verde PedagogIA) */
.btn-prompt-mode.mode-text {
  border-color: rgba(16, 163, 127, 0.4);
  color: #34d399;
  background-color: rgba(16, 163, 127, 0.05);
}
.btn-prompt-mode.mode-text:hover {
  border-color: var(--brand-green);
  background-color: rgba(16, 163, 127, 0.1);
  color: rgb(167, 243, 208);
}

/* Hover no botao de configuracoes da sidebar */
.btn-settings:hover {
  color: var(--text-primary) !important;
  background-color: var(--bg-secondary) !important;
}

/* Avatar do Usuario no Chat */
.user-avatar-img-wrapper {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  background: none !important;
}

.user-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Modal de Configurações */
.settings-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

.settings-modal-content {
  background-color: var(--bg-primary, #121212);
  border: 1px solid var(--border-light, #262626);
  border-radius: 16px;
  width: 450px;
  max-width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  animation: scaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light, #262626);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settings-modal-header h3 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--text-primary, #ffffff);
  font-weight: 600;
}

.close-settings-btn {
  background: none;
  border: none;
  color: var(--text-secondary, #a3a3a3);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
}

.close-settings-btn:hover {
  color: var(--text-primary, #ffffff);
  background-color: rgba(255, 255, 255, 0.05);
}

.settings-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.settings-group label {
  font-size: 0.85rem;
  color: var(--text-secondary, #a3a3a3);
  font-weight: 500;
}

.settings-group input[type="text"],
.settings-group input[type="date"],
.settings-group input[type="password"],
.settings-group input[type="number"],
.settings-group textarea,
.settings-group select {
  background-color: var(--bg-secondary, #1a1a1a);
  border: 1px solid var(--border-light, #262626);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-primary, #ffffff);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.settings-group input[type="text"]:focus,
.settings-group input[type="date"]:focus,
.settings-group input[type="password"]:focus,
.settings-group input[type="number"]:focus,
.settings-group textarea:focus,
.settings-group select:focus {
  border-color: var(--brand-green, #0ea5e9);
}

.avatar-preview-container {
  display: flex;
  align-items: center;
  gap: 16px;
  background-color: var(--bg-secondary, #1a1a1a);
  border: 1px solid var(--border-light, #262626);
  padding: 12px;
  border-radius: 10px;
}

.preview-avatar-img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--brand-green, #0ea5e9);
}

.btn-change-avatar {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light, #262626);
  color: var(--text-primary, #ffffff);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-change-avatar:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.settings-modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-light, #262626);
  display: flex;
  justify-content: flex-end;
}

.btn-save-settings {
  background: linear-gradient(135deg, var(--brand-green) 0%, #0a5f49 100%);
  border: none;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
  box-shadow: 0 0 12px var(--brand-glow);
}

.btn-save-settings:hover {
  opacity: 0.9;
}

/* Modal de Configurações - Tamanho grande para abas */
.settings-modal-large .settings-modal-content {
  max-width: 680px;
  max-height: 85vh;
}

/* Tabs de navegação */
.settings-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 20px 0;
  border-bottom: 1px solid var(--border-light, #262626);
}

.settings-tab {
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary, #a3a3a3);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: all 0.2s;
}

.settings-tab:hover {
  color: var(--text-primary, #ffffff);
  background: rgba(255,255,255,0.05);
}

.settings-tab.active {
  color: var(--brand-green, #10a37f);
  background: rgba(16, 163, 127, 0.1);
  border-bottom: 2px solid var(--brand-green, #10a37f);
}

/* Tab content */
.settings-tab-content {
  display: none;
  padding: 20px 0;
}

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

/* Opções de temperatura */
.temperature-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.temperature-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border-light, #262626);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-secondary, #1a1a1a);
}

.temperature-option:hover {
  border-color: var(--brand-green, #10a37f);
  background: rgba(16, 163, 127, 0.05);
}

.temperature-option.selected {
  border-color: var(--brand-green, #10a37f);
  background: rgba(16, 163, 127, 0.1);
}

.temperature-option input[type="radio"] {
  margin-top: 4px;
  accent-color: var(--brand-green, #10a37f);
}

.temperature-option-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.temperature-option-content strong {
  color: var(--text-primary, #ffffff);
  font-size: 0.95rem;
}

.temperature-option-content span {
  color: var(--text-secondary, #a3a3a3);
  font-size: 0.8rem;
}

/* Lista de conhecimento */
.knowledge-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.knowledge-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-secondary, #1a1a1a);
  border: 1px solid var(--border-light, #262626);
  border-radius: 10px;
}

.knowledge-item-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.knowledge-source {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--brand-green, #10a37f);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.knowledge-item-content p {
  margin: 0;
  color: var(--text-primary, #ffffff);
  font-size: 0.9rem;
  line-height: 1.4;
}

.knowledge-item-content small {
  color: var(--text-muted, #666);
  font-size: 0.75rem;
}

.knowledge-delete-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #666);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s;
}

.knowledge-delete-btn:hover {
  color: #ef4444;
}

/* FAB: Floating Action Button para gravação */
.fab-record {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--brand-green, #10a37f);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(16, 163, 127, 0.4);
  transition: all 0.3s;
  z-index: 998;
  color: white;
}

.fab-record svg {
  width: 22px;
  height: 22px;
}

.fab-record:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(16, 163, 127, 0.5);
}

.fab-record:active {
  transform: scale(0.95);
}

/* Modal de Gravação */
.record-modal-content {
  max-width: 480px !important;
  border-radius: 20px !important;
  overflow: visible !important;
}

.record-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light, #262626);
  background: var(--bg-secondary, #1a1a1a);
}

.record-modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-primary, #ffffff);
  font-family: 'Outfit', sans-serif;
}

.btn-exit-record {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border-light, #262626);
  color: var(--text-secondary, #a3a3a3);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-exit-record:hover {
  color: #ef4444;
  border-color: #ef4444;
}

.btn-exit-record svg {
  width: 16px;
  height: 16px;
}

.record-modal-body {
  padding: 30px 20px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.record-state {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* Timer */
.record-timer {
  font-size: 3rem;
  font-weight: 700;
  color: var(--brand-green, #10a37f);
  font-family: 'Inter', sans-serif;
  letter-spacing: 2px;
}

/* Waveform */
.record-waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 60px;
}

.wave-bar {
  width: 4px;
  background: var(--brand-green, #10a37f);
  border-radius: 2px;
  animation: wave 1s ease-in-out infinite;
  opacity: 0.7;
}

.wave-bar:nth-child(1) { animation-delay: 0s; height: 20px; }
.wave-bar:nth-child(2) { animation-delay: 0.1s; height: 35px; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; height: 50px; }
.wave-bar:nth-child(4) { animation-delay: 0.3s; height: 40px; }
.wave-bar:nth-child(5) { animation-delay: 0.4s; height: 55px; }
.wave-bar:nth-child(6) { animation-delay: 0.5s; height: 30px; }
.wave-bar:nth-child(7) { animation-delay: 0.6s; height: 45px; }
.wave-bar:nth-child(8) { animation-delay: 0.7s; height: 25px; }
.wave-bar:nth-child(9) { animation-delay: 0.8s; height: 50px; }
.wave-bar:nth-child(10) { animation-delay: 0.9s; height: 35px; }
.wave-bar:nth-child(11) { animation-delay: 1.0s; height: 20px; }
.wave-bar:nth-child(12) { animation-delay: 1.1s; height: 40px; }

@keyframes wave {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.5); }
}

.record-hint {
  color: var(--text-secondary, #a3a3a3);
  font-size: 0.95rem;
  text-align: center;
}

.btn-stop-record {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: #ef4444;
  border: none;
  color: white;
  padding: 20px 36px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 10px;
}

.btn-stop-record:hover {
  background: #dc2626;
  transform: scale(1.05);
}

.stop-icon {
  width: 24px;
  height: 24px;
  background: white;
  border-radius: 4px;
}

.btn-stop-record span {
  font-size: 0.85rem;
  font-weight: 500;
}

/* Spinner */
.record-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid var(--border-light, #262626);
  border-top-color: var(--brand-green, #10a37f);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Prévia do relatório */
.preview-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.preview-header h4 {
  margin: 0;
  color: var(--text-primary, #ffffff);
  font-size: 1rem;
}

#previewDateTime {
  font-size: 0.75rem;
  color: var(--text-muted, #666);
}

.report-content {
  width: 100%;
  max-height: 300px;
  overflow-y: auto;
  background: var(--bg-secondary, #1a1a1a);
  border: 1px solid var(--border-light, #262626);
  border-radius: 12px;
  padding: 16px;
  font-size: 0.9rem;
  color: var(--text-primary, #ffffff);
  line-height: 1.6;
}

.report-content p { margin: 0 0 8px 0; }
.report-content strong { color: var(--brand-green, #10a37f); }

.preview-actions {
  width: 100%;
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.btn-discard {
  flex: 1;
  padding: 12px;
  background: transparent;
  border: 1px solid var(--border-light, #262626);
  color: var(--text-secondary, #a3a3a3);
  border-radius: 10px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-discard:hover {
  border-color: #ef4444;
  color: #ef4444;
}

.btn-save-report {
  flex: 1;
  padding: 12px;
  background: var(--brand-green, #10a37f);
  border: none;
  color: white;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-save-report:hover {
  opacity: 0.9;
}

/* Meta info do relatório na prévia */
.report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

.report-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
}

.meta-label {
  color: var(--text-muted, #666);
  font-weight: 500;
}

.tag-chip {
  display: inline-block;
  background: var(--brand-green, #10a37f);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* Botão Minhas Observações na sidebar em estilo tag/pill */
.btn-observacoes {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
  width: auto;
  margin: 0;
}

.btn-observacoes:hover {
  background-color: var(--bg-accent);
  color: var(--text-primary);
  border-color: var(--border-light);
}

#btnEmitirRelatorio:hover {
  background: var(--brand-green) !important;
  color: white !important;
  border-color: var(--brand-green) !important;
}

.btn-observacoes svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.sidebar-divider {
  height: 1px;
  background-color: var(--border-light);
  margin: 8px 16px 8px 16px;
}

/* Modal de Observações */
.obs-modal-content {
  max-width: 640px !important;
  max-height: 85vh;
}

.obs-modal-body {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.obs-filters {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light, #262626);
  flex-wrap: wrap;
}

.obs-select, .obs-input {
  flex: 1;
  min-width: 120px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-light, #262626);
  background: var(--bg-input, #121212);
  color: var(--text-primary, #ffffff);
  font-size: 0.85rem;
}

.obs-input {
  flex: 1;
  min-width: 160px;
}

.obs-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.obs-empty {
  text-align: center;
  color: var(--text-muted, #666);
  padding: 40px 20px;
  font-size: 0.9rem;
}

.obs-item {
  background: var(--bg-secondary, #1a1a1a);
  border: 1px solid var(--border-light, #262626);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.obs-item:hover {
  border-color: var(--brand-green, #10a37f);
  background: var(--bg-input, #121212);
}

.obs-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.obs-item-date {
  font-size: 0.75rem;
  color: var(--text-muted, #666);
}

.obs-item-preview {
  font-size: 0.82rem;
  color: var(--text-secondary, #a3a3a3);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.obs-item-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.obs-tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(16, 163, 127, 0.2);
  color: var(--brand-green, #10a37f);
}

.obs-crianca {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary, #a3a3a3);
}

/* FAB: Floating Action Button para gravação */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Estilo para botões de fechar modal genéricos */
.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-secondary, #a3a3a3);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  width: 32px;
  height: 32px;
}

.btn-close-modal svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

.btn-close-modal:hover {
  color: var(--text-primary, #ffffff);
  background-color: rgba(255, 255, 255, 0.1);
  transform: scale(1.05);
}

/* Estilo para pills interativas de tags */
.tag-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  color: var(--text-secondary, #a3a3a3);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-user-select: none;
  user-select: none;
}

.tag-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary, #ffffff);
}

.tag-pill.active {
  background: rgba(16, 163, 127, 0.2);
  border-color: var(--brand-green, #10a37f);
  color: var(--brand-green, #10a37f);
  font-weight: 600;
}

/* ==========================================================================
   ESTÚDIO MUSICAL
   ========================================================================== */
.btn-music-option, .btn-music-rhythm, .btn-music-duration {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast) ease;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Hover base */
.btn-music-option:hover, .btn-music-rhythm:hover, .btn-music-duration:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: rgba(168, 85, 247, 0.5); /* Default Purple */
  transform: translateY(-1px);
}

/* Active base (Purple - Musica Default) */
.btn-music-option.active, .btn-music-rhythm.active, .btn-music-duration.active {
  background-color: rgba(168, 85, 247, 0.15);
  border-color: #a855f7;
  color: #c084fc;
  font-weight: 600;
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.2);
}

/* =========================================
   CUSTOMIZACAO DE CORES DOS MODAIS
   ========================================= */

/* Estúdio de Poesias (Amarelo/Âmbar #eab308) */
#poesiaModal .btn-music-option:hover, 
#poesiaModal .btn-music-rhythm:hover {
  border-color: rgba(234, 179, 8, 0.5);
}
#poesiaModal .btn-music-option.active, 
#poesiaModal .btn-music-rhythm.active {
  background-color: rgba(234, 179, 8, 0.15);
  border-color: #eab308;
  color: #facc15;
  box-shadow: 0 0 8px rgba(234, 179, 8, 0.2);
}
#poesiaModal .settings-modal-header h3,
#poesiaHistoryModal .settings-modal-header h3 {
  color: #eab308;
}

/* Inventando Histórias (Verde #10a37f) */
#historiaModal .btn-music-option:hover, 
#historiaModal .btn-music-rhythm:hover {
  border-color: rgba(16, 163, 127, 0.5);
}
#historiaModal .btn-music-option.active, 
#historiaModal .btn-music-rhythm.active {
  background-color: rgba(16, 163, 127, 0.15);
  border-color: #10a37f;
  color: #34d399;
  box-shadow: 0 0 8px rgba(16, 163, 127, 0.2);
}
#historiaModal .settings-modal-header h3,
#historiaHistoryModal .settings-modal-header h3 {
  color: #10a37f;
}

/* Planejamento Mind Lab (Violeta #8b5cf6) */
#mindLabModal .btn-music-option:hover, 
#mindLabModal .btn-music-rhythm:hover {
  border-color: rgba(139, 92, 246, 0.5);
}
#mindLabModal .btn-music-option.active, 
#mindLabModal .btn-music-rhythm.active {
  background-color: rgba(139, 92, 246, 0.15);
  border-color: #8b5cf6;
  color: #a78bfa;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.2);
}
#mindLabModal .settings-modal-header h3 {
  color: #8b5cf6;
}

/* Musicando Ideias (Roxo #a855f7) */
#musicaModal .settings-modal-header h3,
#musicaHistoryModal .settings-modal-header h3 {
  color: #a855f7;
}

/* Fábrica de Quadrinhos (Rosa #db2777) */
#fabricaQuadrinhosModal .settings-modal-header h3,
#comicsHistoryModal .settings-modal-header h3 {
  color: #db2777;
}

/* Customização para botões de tags ativos no estúdio */
.btn-music-duration.active {
  background-color: rgba(16, 163, 127, 0.15);
  border-color: var(--brand-green);
  color: var(--brand-green);
  box-shadow: 0 0 8px rgba(16, 163, 127, 0.2);
}

/* Modo Poesia: Estilos e Cores (Amarelo/Âmbar) */
.btn-prompt-mode.mode-poetry {
  border-color: rgba(234, 179, 8, 0.3);
}
.btn-prompt-mode.mode-poetry:hover {
  border-color: rgb(234, 179, 8);
  background-color: rgba(234, 179, 8, 0.06);
  color: rgb(253, 224, 71);
}

/* ==========================================================================
   FÁBRICA DE QUADRINHOS — STORYBOARD STUDIO & PRESENTATION MODE
   ========================================================================== */
.comic-panel-card {
  position: relative;
  border: 3px solid #1e293b;
  background: var(--bg-secondary);
  box-shadow: 4px 4px 0px #1e293b;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s;
}
.comic-panel-card:hover {
  transform: translateY(-3px);
  box-shadow: 6px 8px 0px #1e293b;
}

.comic-panel-image-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: var(--bg-tertiary);
  border-bottom: 2px solid #1e293b;
}

.comic-panel-image-container.ratio-16-9 {
  aspect-ratio: 16/9;
}

.comic-panel-image-container.ratio-4-3 {
  aspect-ratio: 4/3;
}

.comic-panel-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
  display: block;
}
.comic-panel-card:hover .comic-panel-image {
  transform: scale(1.02);
}

.comic-panel-overlay-actions {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  gap: 6px;
  z-index: 15;
  opacity: 0.9;
  transition: opacity 0.2s;
}
.comic-panel-card:hover .comic-panel-overlay-actions {
  opacity: 1;
}

.btn-comic-action {
  background: rgba(15, 23, 42, 0.85);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
  border-radius: 6px;
  padding: 4px 7px;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background 0.2s, transform 0.1s;
}
.btn-comic-action:hover {
  background: var(--brand-pink, #db2777);
  transform: scale(1.05);
}

.comic-speech-bubble {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid #1e293b;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #0f172a;
  box-shadow: 2px 2px 0px rgba(30, 41, 59, 0.2);
  z-index: 10;
  pointer-events: none;
}

.comic-panel-number-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #fef08a; /* Amarelo clássico gibi */
  color: #1e293b;
  font-weight: 800;
  font-size: 0.82rem;
  padding: 2px 8px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #1e293b;
  z-index: 12;
  box-shadow: 2px 2px 0px #1e293b;
}

.comic-caption-text {
  padding: 10px 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.82rem;
  line-height: 1.4;
  border-top: 1px solid var(--border-light);
  font-weight: 500;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.comic-prompt-details {
  display: none;
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px dashed var(--border-light);
  margin-top: 4px;
}

.btn-comics-qty.active, .btn-comics-bubbles.active, .btn-comics-ratio.active, .btn-comics-char.active {
  background-color: rgba(219, 39, 119, 0.15);
  border-color: #db2777;
  color: #f472b6;
  font-weight: 600;
}

/* ==========================================================================
   MODO APRESENTAÇÃO / LEITURA (FULLSCREEN STORYBOARD)
   ========================================================================== */
.comics-presentation-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(10, 10, 15, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  box-sizing: border-box;
}

.comics-pres-header {
  width: 100%;
  max-width: 1000px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
}

.comics-pres-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 960px;
  position: relative;
  margin: 10px 0;
}

.comics-pres-card {
  max-width: 100%;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #0f172a;
  border: 4px solid #334155;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
  animation: comicFadeIn 0.3s ease;
}

.comics-pres-img {
  max-width: 100%;
  max-height: 55vh;
  object-fit: contain;
  display: block;
}

.comics-pres-caption {
  width: 100%;
  background: #ffffff;
  color: #0f172a;
  padding: 16px 24px;
  box-sizing: border-box;
  font-size: 1.15rem;
  font-weight: 600;
  text-align: center;
  border-top: 3px solid #1e293b;
  font-family: 'Fredoka', 'Outfit', sans-serif;
  letter-spacing: 0.3px;
}

.comics-pres-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 10px;
}

.btn-pres-nav {
  background: rgba(255, 255, 255, 0.12);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}
.btn-pres-nav:hover:not(:disabled) {
  background: var(--brand-pink, #db2777);
  transform: scale(1.05);
}
.btn-pres-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

@keyframes comicFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

/* ==========================================================================
   CUSTOM MODAL DIALOGS (ALERT & CONFIRM)
   ========================================================================== */
.custom-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  animation: dialogFadeIn 0.2s ease-out forwards;
}

.custom-dialog-card {
  background: var(--bg-primary, #121212);
  border: 1px solid var(--border-light, #262626);
  border-radius: 16px;
  width: 400px;
  max-width: 90%;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: scale(0.9);
  opacity: 0;
  animation: dialogScaleUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.custom-dialog-header {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary, #ffffff);
  display: flex;
  align-items: center;
  gap: 8px;
}

.custom-dialog-body {
  font-size: 0.92rem;
  color: var(--text-secondary, #a3a3a3);
  line-height: 1.5;
  margin: 0;
}

.custom-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

.btn-dialog {
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.btn-dialog-cancel {
  background: transparent;
  border-color: var(--border-light, #262626);
  color: var(--text-secondary, #a3a3a3);
}

.btn-dialog-cancel:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary, #ffffff);
}

.btn-dialog-confirm {
  background: linear-gradient(135deg, var(--brand-green, #10a37f) 0%, #0a5f49 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 163, 127, 0.25);
}

.btn-dialog-confirm:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-dialog-danger {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-dialog-danger:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

@keyframes dialogFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* FAB: Floating Action Button para Ferramentas */
.fab-tools {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--brand-green, #10a37f);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(16, 163, 127, 0.4);
  transition: all 0.3s;
  z-index: 998;
  color: white;
}

.fab-tools svg {
  width: 22px;
  height: 22px;
}

.fab-tools:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(16, 163, 127, 0.5);
}

.fab-tools:active {
  transform: scale(0.95);
}

.fab-tools.active {
  background: var(--brand-green-dark, #0d8a6b);
  box-shadow: 0 4px 20px rgba(13, 138, 107, 0.6);
}

/* Esconder em telas desktop e tablets (maiores que 768px) */
@media (min-width: 769px) {
  .fab-tools {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .fab-record {
    bottom: 104px !important;
    right: 16px !important;
  }
  
  .fab-tools {
    bottom: 104px !important;
    left: 16px !important;
  }

  .prompt-modes-bar {
    display: none !important;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 0;
  }
  
  .prompt-modes-bar.show {
    display: flex !important;
    max-height: 300px;
    opacity: 1;
    overflow-y: auto;
    padding: 8px 4px;
  }

  /* Otimização Mobile para a Fábrica de Quadrinhos */
  #comicsGridContainer {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  .comic-panel-overlay-actions {
    opacity: 1 !important;
    gap: 4px;
  }

  .btn-comic-action {
    padding: 6px 9px;
    font-size: 0.82rem;
    min-height: 32px;
  }

  .comics-presentation-modal {
    padding: 12px 10px !important;
  }

  .comics-pres-card {
    max-height: 75vh !important;
    border-width: 2px !important;
  }

  .comics-pres-img {
    max-height: 46vh !important;
  }

  .comics-pres-caption {
    font-size: 0.98rem !important;
    padding: 12px 14px !important;
  }

  .btn-pres-nav {
    padding: 8px 16px !important;
    font-size: 0.9rem !important;
  }
}

/* Estilos de progresso da IA (Chain of Thought/Etapas) */
.ia-progress-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 18px;
  background: var(--bg-secondary, #1a1a1a);
  border: 1px solid var(--border-light, #262626);
  border-radius: 12px;
  max-width: 420px;
  margin: 6px 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  animation: iaProgressPulse 2s infinite ease-in-out;
}

.ia-progress-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ia-progress-icon {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(16, 163, 127, 0.2);
  border-radius: 50%;
  border-top-color: var(--brand-green, #10a37f);
  animation: iaProgressSpin 1s linear infinite;
  flex-shrink: 0;
}

.ia-progress-step-text {
  font-size: 13px;
  color: var(--text-primary, #ffffff);
  font-weight: 500;
  font-family: var(--font-sans);
}

.ia-progress-bar {
  width: 100%;
  height: 5px;
  background-color: var(--bg-tertiary, #121212);
  border-radius: 3px;
  overflow: hidden;
}

.ia-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-green, #10a37f) 0%, #06b6d4 100%);
  border-radius: 3px;
  width: 10%;
  transition: width 0.5s ease-out;
}

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

@keyframes iaProgressPulse {
  0% { border-color: var(--border-light, #262626); }
  50% { border-color: rgba(16, 163, 127, 0.4); }
  100% { border-color: var(--border-light, #262626); }
}

/* Estilos para o Preview do Cartaz (Estúdio de Cartazes PedaGog) */
#cartazPrintableArea {
  container-type: inline-size;
  box-sizing: border-box;
  overflow: hidden !important; /* STRICT LIMIT: nothing overflows the paper! */
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Garante que o conteúdo de texto se ajuste */
#cartazPreviewContent {
  font-size: 3.5cqw !important;
  line-height: 1.4 !important;
  flex: 1;
  display: flex;
  gap: 3cqw;
  overflow: hidden;
}

#cartazPreviewContent > div, 
#cartazPreviewContent > p, 
#cartazPreviewContent > ul {
  box-sizing: border-box !important;
  padding: 3.5cqw !important;
  border-radius: 2cqw !important;
  font-size: 3cqw !important;
  margin: 0 !important;
}

#cartazPreviewContent h2,
#cartazPreviewContent h3 {
  font-size: 4.5cqw !important;
  margin-top: 0 !important;
  margin-bottom: 2cqw !important;
}

#cartazPreviewContent li {
  font-size: 2.8cqw !important;
  margin-bottom: 1.5cqw !important;
}

/* Título principal do cartaz */
#cartazPreviewTitle {
  font-size: 7cqw !important;
  border-bottom-width: 0.5cqw !important;
  padding-bottom: 2cqw !important;
  margin-bottom: 4cqw !important;
  margin-top: 0 !important;
}

/* Imagem ilustrativa */
#cartazPreviewImageContainer {
  margin-bottom: 3cqw !important;
  border-radius: 2cqw !important;
  max-height: 35% !important;
}

#cartazPreviewImage {
  max-height: 100% !important;
}

/* Estilos de Itens do Canvas (Arrastáveis e Redimensionáveis) */
.canvas-item {
  position: absolute !important;
  box-sizing: border-box;
  cursor: move;
  border: 1px dashed rgba(59, 130, 246, 0.4);
  padding: 10px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  user-select: text; /* Permite selecionar texto interno para edição */
  overflow: visible !important; /* Garante que a alça de resize não seja cortada */
}

.canvas-item:hover {
  border-color: rgba(59, 130, 246, 0.8);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.2);
}

.canvas-item.active-item {
  border: 2.5px solid #3b82f6 !important;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
  z-index: 1000;
}

/* Alça de redimensionamento do card */
.canvas-resize-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #3b82f6;
  border: 2px solid white;
  border-radius: 50%;
  bottom: -7px;
  right: -7px;
  cursor: se-resize;
  z-index: 10;
  display: none;
}

.canvas-item.active-item .canvas-resize-handle {
  display: block;
}

/* Oculte alças e tracejados na impressão e exportação */
@media print {
  .canvas-resize-handle {
    display: none !important;
  }
  .canvas-item {
    border: none !important;
    box-shadow: none !important;
    cursor: default !important;
  }
}

/* Camadas de Cena (Estúdio de Cenas em Camadas) */
.canvas-scene-layer {
  padding: 0 !important;
  background: transparent !important;
  border-radius: 4px !important;
  overflow: visible !important; /* IMPORTANTE: permite que a alça de resize fique fora do item */
}

/* A imagem dentro da camada fica com overflow clipado no wrapper interno */
.canvas-scene-layer img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  border-radius: 4px;
}

.canvas-scene-layer:hover {
  border-color: rgba(139, 92, 246, 0.8);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
}

.canvas-scene-layer.active-item {
  border: 2px dashed #8b5cf6 !important;
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.4);
}

/* Animação dos dots de loading */
@keyframes dot-pulse {
  0%, 60%, 100% { transform: scale(1); opacity: 0.5; }
  30% { transform: scale(1.4); opacity: 1; }
}

/* Botão Estúdio de Cenas */
#btnDecomposeScene:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

#btnDecomposeScene:disabled {
  cursor: not-allowed;
}

/* Lista de camadas no painel */
#sceneLayersItems > div:hover {
  background: rgba(139, 92, 246, 0.12) !important;
  border-color: rgba(139, 92, 246, 0.4) !important;
}

/* ============================================================
   ESTILOS DO MUSICANDO IDEIAS (ESTÚDIO PROFISSIONAL)
   ============================================================ */
.tag-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 0.75rem;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.tag-checkbox:hover {
  background: rgba(168, 85, 247, 0.12);
  border-color: rgba(168, 85, 247, 0.4);
}

.tag-checkbox:has(input:checked) {
  background: rgba(168, 85, 247, 0.2);
  border-color: #a855f7;
  color: #d8b4fe;
  font-weight: 600;
}

.tag-checkbox input[type="checkbox"] {
  accent-color: #a855f7;
  cursor: pointer;
}

/* Animação do Visualizer de Áudio */
.wave-bar {
  transition: height 0.15s ease;
}

.wave-bar.wave-active {
  animation: wave-pulse 0.8s infinite ease-in-out alternate;
}

.wave-bar.wave-active:nth-child(2n) {
  animation-duration: 0.6s;
  animation-delay: 0.1s;
}

.wave-bar.wave-active:nth-child(3n) {
  animation-duration: 0.9s;
  animation-delay: 0.2s;
}

.wave-bar.wave-active:nth-child(4n) {
  animation-duration: 0.7s;
  animation-delay: 0.15s;
}

@keyframes wave-pulse {
  0% { height: 20%; background-color: #a855f7; }
  50% { height: 95%; background-color: #ec4899; }
  100% { height: 40%; background-color: #3b82f6; }
}

@keyframes wave-pulse-poesia {
  0% { height: 20%; background-color: #eab308; }
  50% { height: 95%; background-color: #f59e0b; }
  100% { height: 40%; background-color: #fbbf24; }
}

@keyframes wave-pulse-historia {
  0% { height: 20%; background-color: #10b981; }
  50% { height: 95%; background-color: #34d399; }
  100% { height: 40%; background-color: #059669; }
}

@media (max-width: 768px) {
  #musicaLeftPanel, #musicaRightPanel,
  #poesiaLeftPanel, #poesiaRightPanel,
  #historiaLeftPanel, #historiaRightPanel {
    min-width: 100% !important;
    width: 100% !important;
  }
}

/* ==========================================================================
   OTIMIZAÇÕES MOBILE-FIRST (SMARTPHONES & TABLETS - 60% A 70% DOS ACESSOS)
   ========================================================================== */
@media (max-width: 768px) {
  /* 1. Prevenção de Auto-Zoom no iOS Safari & inputs confortáveis */
  input, select, textarea, .obs-input, .obs-select, .search-input {
    font-size: 16px !important;
    min-height: 44px;
    border-radius: 8px;
  }
  
  textarea, .obs-input[rows] {
    min-height: 70px;
  }

  /* 2. Touch Targets para botões de toque no celular (mínimo 44px) */
  .btn-close-modal, .modal-tag-close, .search-clear, #searchClearAll {
    min-width: 44px !important;
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.6rem !important;
  }

  .btn-observacoes, .btn-prompt-mode, .btn-music-option, .tag-filter {
    min-height: 42px !important;
    padding: 8px 14px !important;
    font-size: 0.88rem !important;
  }

  /* 3. Modais Responsivos (Aproveitamento Total da Tela no Mobile) */
  .settings-modal-content {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 94dvh !important;
    height: 94dvh !important;
    border-radius: 18px 18px 0 0 !important;
    margin: 0 !important;
  }

  .settings-modal {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  .settings-modal-header {
    padding: 12px 16px !important;
  }

  .settings-modal-body {
    padding: 14px 12px !important;
    gap: 16px !important;
  }

  /* 4. Layouts em Coluna Única Empilhada para Todas as Ferramentas */
  #criseModal .settings-modal-body,
  #ataModal .settings-modal-body,
  #stickerModal .settings-modal-body,
  #poesiaModal .settings-modal-body,
  #musicaModal .settings-modal-body,
  #historiaModal .settings-modal-body,
  #cartazModal .settings-modal-body,
  #mindLabModal .settings-modal-body,
  #alunoTimelineModal .settings-modal-body,
  #csvImportModal .settings-modal-body {
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  #criseModal .settings-modal-body > div,
  #ataModal .settings-modal-body > div,
  #stickerModal .settings-modal-body > div,
  #poesiaLeftPanel, #poesiaRightPanel,
  #musicaLeftPanel, #musicaRightPanel,
  #historiaLeftPanel, #historiaRightPanel {
    min-width: 100% !important;
    width: 100% !important;
    flex: none !important;
  }

  /* 5. Grid de Stickers no Mobile (2 colunas perfeitas) */
  #stickersListGrid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    max-height: 320px !important;
  }

  /* 6. Estúdio de Cartazes & Storyboard no Mobile */
  #cartazModal .settings-modal-body {
    display: flex !important;
    flex-direction: column !important;
  }

  #cartazCanvasContainer {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    padding: 6px !important;
  }

  #cartazPrintableArea {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1.414 !important;
  }

  .cartaz-tools-sidebar {
    width: 100% !important;
    max-height: 220px !important;
    overflow-y: auto !important;
  }

  /* 7. Player e Waveforms de Áudio no Celular */
  .audio-player-card, .mini-waveform-container {
    width: 100% !important;
    padding: 10px !important;
  }

  .audio-controls-row {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  /* 8. Safe Area Inset no Rodapé para iPhones com Notch / Androids */
  .chat-footer {
    padding-bottom: max(10px, env(safe-area-inset-bottom)) !important;
  }
}







