/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* ========================================================================
   THEMING VIA CSS VARIABLES
   ======================================================================== */

/*
  Theming via CSS variables
  - Keep brand tokens (lare-gold, lare-navy, lare-cream) stable across themes
  - Only override neutrals and surfaces in dark mode
*/

/* Base (light) theme variables */
:root {
  /* Brand: keep identical in light and dark */
  --color-lare-gold: #D4AF37; /* brand gold */
  --color-lare-navy: #1A2B42; /* brand navy */
  --color-lare-cream: #F8F7F4; /* brand cream (page bg) */

  /* Neutrals (light defaults) */
  --color-white: #FFFFFF;
  --color-black: #000000;
  --color-gray-200: #E5E7EB;
  --color-gray-300: #D1D5DB;
  --color-gray-500: #6B7280;
  --color-gray-600: #4B5563;

  /* Sidebar variables */
  --sidebar-width-expanded: 18rem; /* 288px = w-72 */
  --sidebar-width-collapsed: 4rem; /* 64px = w-16 */
}

/* Dark theme overrides (neutrals + surfaces only) */
:root[data-theme="dark"] {
  color-scheme: dark;

  /* Fundo principal da página (o mais escuro) */
  --color-lare-cream: #0D172A; /* page background in dark */
  --color-white: #1D2939;      /* card/surface background in dark */

  /* Cores de borda para separar elementos */
  --color-gray-200: #333F54; /* Borda subtil para os cards */
  --color-gray-300: #4A5568;

  /* Cor principal para títulos e textos importantes */
  --color-lare-navy: #F0F2F5; /* Texto padrão em dark (mantém a token, mas clara) */

  /* Cor para texto secundário e descrições */
  --color-gray-500: #A0AEC0;
  --color-gray-600: #CBD5E0;

  /* Cor para texto primário (contrasta com o branco suave) */
  --color-black: #FFFFFF;
}

/* Aplica a cor de fundo base ao body */
body {
  background-color: var(--color-lare-cream);
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
}

/* Garante que os cards e outras superfícies usem a nova cor de "fundo de card" */
.card, .surface, .bg-white {
  background-color: var(--color-white);
  color: var(--color-lare-navy);
}

/* ========================================================================
   GLOBAL STYLES
   ======================================================================== */

html {
  scroll-behavior: smooth;
}

/* ========================================================================
   SCROLL ANIMATIONS
   ======================================================================== */

.animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Delay opcional para elementos em sequência */
.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }

/* ========================================================================
   SIDEBAR COMPONENT STYLES
   ======================================================================== */

/* Sidebar responsive padding classes */
.sidebar-main-padding {
  padding-left: 0;
}

@media (min-width: 1024px) {
  .sidebar-main-padding {
    padding-left: var(--sidebar-width-expanded);
  }

  /* When sidebar is collapsed */
  [data-sidebar-collapsed="true"] .sidebar-main-padding {
    padding-left: var(--sidebar-width-collapsed);
  }
}

/* ========================================================================
   FILE UPLOAD COMPONENT STYLES
   ======================================================================== */

.file-upload-dropzone {
  transition: all 0.2s ease-in-out;
}

.file-upload-dropzone:hover {
  border-color: #B8860B; /* lare-gold */
  background-color: rgba(184, 134, 11, 0.05);
}

/* Drag states */
.file-upload-dropzone--highlighted {
  border-color: #B8860B !important; /* lare-gold */
  background-color: rgba(184, 134, 11, 0.05) !important;
  border-width: 2px !important;
  border-style: solid !important;
  transform: scale(1.05);
}

.file-upload-dropzone--highlighted .file-upload-text {
  color: #B8860B; /* lare-gold */
}

/* Loading indicator */
.file-upload-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.file-upload-loading__spinner {
  width: 2rem;
  height: 2rem;
  border: 2px solid transparent;
  border-bottom: 2px solid #B8860B; /* lare-gold */
  border-radius: 50%;
  animation: file-upload-spin 1s linear infinite;
}

.file-upload-loading__text {
  font-size: 0.875rem;
  color: #6B7280; /* text-gray-600 */
}

/* Preview image */
.file-upload-preview {
  margin: 0 auto;
  height: 8rem;
  width: auto;
  border-radius: 0.375rem;
  object-fit: cover;
  transition: all 0.3s ease-in-out;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.file-upload-preview:hover {
  transform: scale(1.02);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Loading animation for file processing */
@keyframes file-upload-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========================================================================
   SWEETALERT2 COMPONENT STYLES
   ======================================================================== */

/* SweetAlert2 Base Layout Adjustments (non-intrusive) */
.swal2-container.swal2-center-modal {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 1rem !important;
  min-height: 100vh;
  inset: 0 !important;
}
@supports (height: 100dvh) { .swal2-container.swal2-center-modal { min-height: 100dvh; } }

/* Modal specific theme */
.swal2-popup.swal2-lare-modal {
  font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
  border-radius: 1rem !important;
  border: none !important;
  padding: 2rem !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(30, 64, 175, 0.05) !important;
  background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%) !important;
  max-width: 480px !important;
  margin: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: visible !important;
}

.swal2-popup.swal2-lare-modal .swal2-title {
  font-size: 1.375rem !important;
  font-weight: 700 !important;
  color: #1e40af !important;
  line-height: 1.3 !important;
  margin-bottom: 1.5rem !important;
  margin-top: 1rem !important;
  letter-spacing: -0.025em !important;
}

.swal2-popup.swal2-lare-modal .swal2-html-container {
  font-size: 1rem !important;
  line-height: 1.6 !important;
  color: #4b5563 !important;
  margin-bottom: 1.5rem !important;
  flex: 0 0 auto !important;
  overflow: visible !important;
}

.swal2-icon {
  border: none !important;
  border-radius: 50% !important;
  font-size: 2rem !important;
}

.swal2-icon.swal2-success {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%) !important;
  color: #059669 !important;
  box-shadow: 0 8px 25px rgba(5, 150, 105, 0.2) !important;
}

.swal2-icon.swal2-error {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%) !important;
  color: #dc2626 !important;
  box-shadow: 0 8px 25px rgba(220, 38, 38, 0.2) !important;
}

.swal2-icon.swal2-warning {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important;
  color: #d97706 !important;
  box-shadow: 0 8px 25px rgba(217, 119, 6, 0.2) !important;
}

.swal2-icon.swal2-info {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%) !important;
  color: #2563eb !important;
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.2) !important;
}

.swal2-icon.swal2-question {
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%) !important;
  color: #4f46e5 !important;
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.2) !important;
}

/* Toast specific styles */
.swal2-toast {
  border-radius: 0.75rem !important;
  padding: 1rem 1.5rem !important;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
  border: 1px solid rgba(30, 64, 175, 0.1) !important;
  backdrop-filter: blur(10px) !important;
  background: rgba(255, 255, 255, 0.95) !important;
}

.swal2-toast .swal2-title {
  font-size: 1rem !important;
  margin: 0 !important;
  color: #1e40af !important;
  font-weight: 600 !important;
}

.swal2-toast .swal2-icon {
  margin: 0 0.75rem 0 0 !important;
  width: 1.5rem !important;
  height: 1.5rem !important;
  font-size: 1rem !important;
}

/* Progress bar customization */
.swal2-timer-progress-bar {
  background: linear-gradient(90deg, #fbbf24 0%, #f59e0b 100%) !important;
  height: 4px !important;
}

/* Legacy class retained for toasts or simple popups */
.swal2-lare {
  background-color: #F8F7F4;
  color: #1A2B42;
  border: 1px solid rgba(212,175,55,0.3);
  border-radius: 0.75rem;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  padding: 1rem 1.5rem;
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  width: min(90vw, 420px) !important;
  max-height: 80vh;
  overflow: visible;
  display: flex;
  flex-direction: column;
}

.swal2-lare .swal2-title {
  font-weight: 600;
  color: #1A2B42;
}

.swal2-lare .swal2-html-container {
  font-size: 0.875rem;
  color: rgba(26,43,66,0.8);
  margin-top: 0.25rem;
}

.swal2-lare .swal2-actions {
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

@media (max-width: 420px) {
  .swal2-popup.swal2-lare-modal { padding: 1.25rem 1.25rem !important; max-width: 92vw !important; }
  .swal2-popup.swal2-lare-modal .swal2-title { font-size: 1.125rem !important; margin-top: 0.25rem !important; }
  .swal2-popup.swal2-lare-modal .swal2-html-container { font-size: 0.875rem !important; margin-bottom: 1rem !important; }
  .swal2-container.swal2-center-modal { padding: 0.75rem !important; }
}

@media (min-width: 1024px) {
  .swal2-lare { width: 400px !important; }
}

/* ========================================================================
   CHAT COMPONENT STYLES
   ======================================================================== */

.message-item {
  scroll-margin-bottom: 1rem;
  animation: messageSlideIn 0.3s ease-out;
}

/* Scroll suave para o container de mensagens */
[data-controller="chat-unified"],
[data-controller*="chat-pagination"] {
  scroll-behavior: smooth;
}

/* Animação para novas mensagens */
@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Separador de data */
.date-separator {
  animation: fadeIn 0.3s ease-out;
}

.date-separator .date-badge {
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

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

/* Indicador de digitação (para futuro uso) */
.typing-indicator {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  background-color: #f3f4f6;
  border-radius: 1rem;
  margin-bottom: 1rem;
}

.typing-indicator::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #6b7280;
  animation: typing 1.4s infinite;
  margin-left: 0.5rem;
}

@keyframes typing {
  0%, 60%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  30% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Estilo do textarea com auto-resize */
[data-controller="auto-resize"] {
  min-height: 3rem;
  max-height: 7.5rem;
  transition: height 0.1s ease;
}

/* Hover state para mensagens */
.message-item:hover .message-time {
  opacity: 1;
}

.message-time {
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

/* ===================== MOBILE STYLES ===================== */

/* Touch responsivo para links em mobile */
@media (max-width: 1024px) {
  .mobile-chat-link {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
  }

  .mobile-chat-link:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }

  /* Container de mensagens mais compacto no mobile */
  .mobile-messages-container {
    padding: 0.75rem;
  }

  .mobile-messages-container .message-item {
    margin-bottom: 0.75rem;
  }

  /* Form mais compacto no mobile */
  .mobile-message-form {
    padding: 0.75rem;
  }

  .mobile-message-form textarea {
    font-size: 16px; /* Previne zoom no iOS */
    padding: 0.75rem 1rem;
  }

  /* Back button hover effect */
  .mobile-back-button:active {
    background-color: rgba(0, 0, 0, 0.1);
    transform: scale(0.95);
  }
}

/* Animação específica para transições mobile */
@media (max-width: 1024px) {
  turbo-frame[id="mobile_content"] {
    animation: mobileSlideIn 0.3s ease-out;
  }
}

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

/* ========================================================================
   INTL TEL INPUT COMPONENT STYLES
   ======================================================================== */

/* Custom styling for intl-tel-input to match our design */
.iti {
  width: 100%;
}

.iti__tel-input {
  border: 1px solid rgb(209 213 219) !important; /* border-gray-300 */
  border-radius: 0.375rem !important; /* rounded-md */
  padding: 0.5rem 0.75rem 0.5rem 4rem !important; /* px-3 py-2 + padding-left para a bandeira */
  font-size: 1rem !important; /* text-base */
  color: rgb(15 23 42) !important; /* text-lare-navy */
  background-color: white !important;
}

.iti__tel-input:focus {
  border-color: rgb(251 191 36) !important; /* border-lare-gold */
  box-shadow: 0 0 0 2px rgb(251 191 36 / 0.2) !important; /* ring-lare-gold */
  outline: none !important;
}

.iti__tel-input::placeholder {
  color: rgb(156 163 175) !important; /* placeholder:text-gray-400 */
}

.iti__flag-container {
  border-right: 1px solid rgb(209 213 219) !important;
}

.iti__selected-flag {
  padding: 0.5rem !important;
  display: flex !important;
  align-items: center !important;
}

.iti__flag {
  margin-right: 0.5rem !important;
  flex-shrink: 0 !important; /* Impede que a bandeira encolha */
}

.iti__selected-dial-code {
  margin-left: 0.75rem !important; /* Espaço específico para o código do país */
  display: inline-block !important;
  font-weight: 500 !important;
  color: rgb(75 85 99) !important; /* text-gray-600 */
}

/* Ensure dropdown is hidden by default */
.iti__dropdown-content.iti__hide {
  display: none !important;
}

/* Dropdown styling */
.iti__country-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid rgb(209 213 219);
  border-radius: 0.375rem;
  background: white;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.iti__search-input {
  border: 1px solid rgb(209 213 219) !important;
  border-radius: 0.375rem !important;
  padding: 0.5rem !important;
  margin: 0.5rem !important;
  width: calc(100% - 1rem) !important;
}

.iti__country:hover {
  background-color: rgb(243 244 246) !important; /* hover:bg-gray-100 */
}

.iti__country.iti__highlight {
  background-color: rgb(251 191 36) !important; /* bg-lare-gold */
  color: white !important;
}
