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

@keyframes ripple {
  0% { transform: scale(0); opacity: 0.5; }
  100% { transform: scale(4); opacity: 0; }
}

@keyframes pulse-subtle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #b99d9d;
  font-size: 0.875rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

.checkbox-label:hover {
  color: #d4b5b5;
}

.checkbox-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: #ec1313;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.checkbox-label input[type="checkbox"]:hover {
  transform: scale(1.1);
}

.checkbox-label input[type="checkbox"]:checked {
  animation: pulse-subtle 0.3s ease;
}

.rol-select,
.tenant-select {
  background: #1f1515;
  border: 1px solid #543b3b;
  border-radius: 0.375rem;
  color: white;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.rol-select:hover,
.tenant-select:hover {
  border-color: #7a5555;
  background: #2a1a1a;
}

.rol-select:focus,
.tenant-select:focus {
  outline: none;
  border-color: #ec1313;
  box-shadow: 0 0 0 3px rgba(236, 19, 19, 0.15);
}

.btn-edit,
.btn-delete {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
}

.btn-edit {
  background: #3b82f6;
  color: white;
  box-shadow: 0 1px 2px rgba(59, 130, 246, 0.2);
}

.btn-edit:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-edit:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 1px 2px rgba(59, 130, 246, 0.2);
}

.btn-delete {
  background: #ec1313;
  color: white;
  box-shadow: 0 1px 2px rgba(236, 19, 19, 0.2);
}

.btn-delete:hover {
  background: #b90e0e;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(236, 19, 19, 0.3);
}

.btn-delete:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 1px 2px rgba(236, 19, 19, 0.2);
}

button,
[role="button"],
.admin-tab,
.tab-btn {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid #ec1313;
  outline-offset: 2px;
}

button:disabled,
[role="button"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

button:not(:disabled):hover {
  filter: brightness(1.05);
}

button:not(:disabled):active {
  transform: scale(0.97);
}

.admin-tab:hover:not(.bg-primary) {
  transform: translateY(-1px);
}

.admin-tab.bg-primary {
  box-shadow: 0 2px 8px rgba(236, 19, 19, 0.3);
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="password"],
textarea {
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

/* Estilos mejorados para desplegables */
select,
.form-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: #1f1515;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ec1313' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  border: 1px solid #543b3b;
  border-radius: 8px;
  padding: 10px 40px 10px 12px;
  color: white;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

select:hover:not(:disabled),
.form-select:hover:not(:disabled) {
  border-color: #ec1313;
  background-color: #2a1a1a;
}

select:focus,
.form-select:focus {
  border-color: #ec1313;
  box-shadow: 0 0 0 3px rgba(236, 19, 19, 0.25);
  outline: none;
  background-color: #2a1a1a;
}

select:disabled,
.form-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: #1a1010;
}

select option,
.form-select option {
  background-color: #1f1515;
  color: white;
  padding: 8px;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="password"]:focus,
textarea:focus {
  box-shadow: 0 0 0 3px rgba(236, 19, 19, 0.15);
}

input[type="text"]:hover:not(:focus):not(:disabled),
input[type="email"]:hover:not(:focus):not(:disabled),
input[type="number"]:hover:not(:focus):not(:disabled),
input[type="date"]:hover:not(:focus):not(:disabled),
input[type="password"]:hover:not(:focus):not(:disabled),
textarea:hover:not(:focus):not(:disabled) {
  border-color: #7a5555;
}

tr {
  transition: background-color 0.15s ease;
}

.badge,
[class*="rounded-full"][class*="px-"] {
  transition: all 0.2s ease;
}

.badge:hover,
[class*="rounded-full"][class*="px-"]:hover {
  transform: scale(1.02);
}

.modal-content,
[class*="bg-card-bg"][class*="rounded"] {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.card-hover {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }
  
  body {
    background: white !important;
    color: black !important;
    font-size: 10pt;
    margin: 0;
    padding: 0;
  }
  
  header, nav, aside, footer,
  .sidebar, .tab-buttons, .filter-controls, .export-buttons,
  button, [onclick], .no-print,
  #header, #sidebar, .tabs-container, .filters-section,
  #navTabs, #dashboardKPI, #showEventFormBtn, #eventFormContainer,
  .material-symbols-outlined:not(.print-visible),
  [data-action], .admin-tab, .toggle-icon,
  #logoutBtn, #tenantSelectorBtn, .user-dropdown,
  .pagination, .pagination-controls,
  .flex.gap-2.flex-wrap, .inline-flex.items-center.gap-2,
  [class*="hover:"], [class*="cursor-pointer"] {
    display: none !important;
  }
  
  #mainSection {
    display: block !important;
    padding: 0 !important;
  }
  
  .main-content, #balanceTree, #ledgerTable, #mayorTableBody,
  .tab-content:not(.hidden) {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
  }
  
  .tab-content {
    display: none !important;
  }
  
  .tab-content:not(.hidden) {
    display: block !important;
  }
  
  table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 9pt !important;
    page-break-inside: auto;
  }
  
  thead {
    display: table-header-group;
  }
  
  tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }
  
  th, td {
    border: 1px solid #333 !important;
    padding: 4px 6px !important;
    background: white !important;
    color: black !important;
    text-align: left !important;
  }
  
  th {
    background: #e8e8e8 !important;
    font-weight: bold !important;
  }
  
  tr:nth-child(even) td {
    background: #f5f5f5 !important;
  }
  
  [data-level="0"] td {
    background: #d0d0d0 !important;
    font-weight: bold !important;
    font-size: 10pt !important;
  }
  
  [data-level="1"] td {
    background: #e0e0e0 !important;
    font-weight: 600 !important;
  }
  
  [data-level="2"] td {
    background: #ebebeb !important;
  }
  
  h1, h2, h3 {
    color: black !important;
    page-break-after: avoid;
  }
  
  @page {
    margin: 1.5cm;
    size: A4 landscape;
  }
  
  @page :first {
    margin-top: 2cm;
  }
  
  .print-header {
    display: block !important;
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #333;
    padding-bottom: 10px;
  }
  
  .print-header h1 {
    font-size: 16pt;
    margin-bottom: 5px;
    font-weight: bold;
  }
  
  .print-header p {
    font-size: 10pt;
    color: #444;
  }
  
  .bg-green-900\/30 {
    background: #c8e6c9 !important;
  }
  
  .text-green-400 {
    color: #2e7d32 !important;
  }
  
  .font-mono {
    font-family: 'Courier New', monospace !important;
  }
}


/* -- Formularios ----------------------------------------------- */
.form-input {
    @apply w-full bg-surface-darker border border-border-dark rounded-xl px-4 py-3
           text-sm text-white focus:outline-none focus:border-primary transition-colors;
}

.form-select {
    @apply w-full bg-surface-darker border border-border-dark rounded-xl px-4 h-11
           text-sm text-white focus:outline-none focus:border-primary transition-colors
           appearance-none cursor-pointer;
}

.form-label {
    @apply text-white text-sm font-medium;
}

.form-group {
    @apply flex flex-col gap-2;
}

/* -- Botones --------------------------------------------------- */
.btn-primary {
    @apply flex items-center justify-center gap-2 h-11 px-6
           bg-primary hover:bg-red-700 text-white font-bold rounded-xl
           shadow-lg shadow-primary/20 transition-colors disabled:opacity-50
           disabled:cursor-not-allowed;
}

.btn-secondary {
    @apply flex items-center justify-center gap-2 h-11 px-6
           bg-surface-darker border border-border-dark hover:border-text-secondary
           text-white font-bold rounded-xl transition-colors disabled:opacity-50;
}

.btn-ghost {
    @apply flex items-center justify-center gap-2 h-9 px-4
           text-text-secondary hover:text-white text-sm font-bold
           rounded-lg transition-colors;
}

.btn-danger {
    @apply flex items-center justify-center gap-2 h-11 px-6
           bg-red-900/30 border border-red-800/50 hover:bg-red-900/50
           text-red-400 font-bold rounded-xl transition-colors;
}

/* -- Badges / Pills -------------------------------------------- */
.badge {
    @apply px-2 py-0.5 rounded text-[10px] font-black uppercase tracking-wider;
}
.badge-success { @apply bg-emerald-500/10 text-emerald-400 border border-emerald-500/20; }
.badge-warning { @apply bg-amber-500/10 text-amber-400 border border-amber-500/20; }
.badge-danger  { @apply bg-red-500/10 text-red-400 border border-red-500/20; }
.badge-info    { @apply bg-blue-500/10 text-blue-400 border border-blue-500/20; }
.badge-neutral { @apply bg-surface-darker text-text-secondary border border-border-dark; }

/* -- Estados de carga ------------------------------------------ */
.skeleton {
    @apply bg-surface-darker animate-pulse rounded-xl;
}

.spinner-sm { @apply animate-spin rounded-full h-4 w-4 border-b-2 border-primary; }
.spinner-md { @apply animate-spin rounded-full h-6 w-6 border-b-2 border-primary; }
.spinner-lg { @apply animate-spin rounded-full h-10 w-10 border-b-2 border-primary; }

/* -- Empty states ---------------------------------------------- */
.empty-state {
    @apply flex flex-col items-center gap-4 py-20 text-center;
}
.empty-state .empty-icon {
    @apply text-6xl text-text-disabled material-symbols-outlined;
}
.empty-state h3 { @apply text-white font-bold text-xl; }
.empty-state p  { @apply text-text-secondary text-sm max-w-xs; }

/* -- Alertas --------------------------------------------------- */
.alert {
    @apply flex items-start gap-3 p-4 rounded-xl border;
}
.alert-danger  { @apply bg-red-900/20 border-red-800/40 text-red-300; }
.alert-success { @apply bg-emerald-900/20 border-emerald-800/40 text-emerald-300; }
.alert-warning { @apply bg-amber-900/20 border-amber-800/40 text-amber-300; }
.alert-info    { @apply bg-blue-900/20 border-blue-800/40 text-blue-300; }

/* -- Tablas ---------------------------------------------------- */
.data-table {
    @apply w-full text-left border-collapse;
}
.data-table thead tr {
    @apply bg-surface-darker/60 border-b border-border-dark;
}
.data-table thead th {
    @apply px-4 py-3 text-[10px] font-bold uppercase tracking-widest text-text-secondary;
}
.data-table tbody tr {
    @apply border-b border-border-dark/30 hover:bg-white/5 transition-colors;
}
.data-table tbody td {
    @apply px-4 py-3 text-sm;
}

/* -- Páginas --------------------------------------------------- */
.page-container {
    @apply flex flex-col gap-6 p-6;
}
.page-header {
    @apply flex justify-between items-start flex-wrap gap-3;
}
.page-title {
    @apply text-3xl font-black tracking-tight text-white m-0;
}
.page-subtitle {
    @apply text-text-secondary text-sm;
}
/* ================================================================
   DARK FORM OVERRIDES â€” fixes white background on inputs/selects
   in the EventoDrawer and all other dark-UI forms.
   These rules use !important to beat browser defaults + Tailwind forms plugin.
   ================================================================ */

/* Base dark background for all native inputs */
input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="password"],
input[type="search"],
textarea {
  background-color: #222222 !important;
  color: #ffffff !important;
  border: 1px solid #595959 !important;
  color-scheme: dark;
}

/* Focus ring */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
textarea:focus {
  background-color: #2c2c2c !important;
  border-color: #ec1313 !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(236, 19, 19, 0.18) !important;
}

/* Chrome/Edge autofill â€” inset shadow trick overrides the yellow/white fill */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #222222 inset !important;
  box-shadow:         0 0 0 1000px #222222 inset !important;
  -webkit-text-fill-color: #ffffff !important;
  caret-color: #ffffff !important;
  border-color: #595959 !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* .form-input explicit overrides (used in EventoDrawer) */
.form-input {
  background-color: #222222 !important;
  color: #ffffff !important;
  border-color: #595959 !important;
  color-scheme: dark;
}
.form-input:focus {
  background-color: #2c2c2c !important;
  border-color: #ec1313 !important;
}

/* date picker calendar icon color on dark bg */
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(0.6);
  cursor: pointer;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover {
  filter: invert(1) opacity(1);
}

/* ================================================================
   SELECT DARK OVERRIDE â€” fixes white background on <select> /
   Blazor <InputSelect> elements. Tailwind forms plugin and browser
   defaults are beaten with !important + color-scheme: dark.
   ================================================================ */

select,
select.form-select,
.form-select {
  background-color: #222222 !important;
  color: #ffffff !important;
  border: 1px solid #595959 !important;
  border-radius: 0.75rem !important;
  color-scheme: dark !important;
}

select:focus,
select.form-select:focus,
.form-select:focus {
  background-color: #2c2c2c !important;
  border-color: #ec1313 !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(236, 19, 19, 0.18) !important;
}

select:hover:not(:disabled),
select.form-select:hover:not(:disabled),
.form-select:hover:not(:disabled) {
  border-color: #7a7a7a !important;
}

select:disabled,
select.form-select:disabled,
.form-select:disabled {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
}

select option,
.form-select option {
  background-color: #222222 !important;
  color: #ffffff !important;
}

/* Textarea explicit override */
textarea,
textarea.form-input {
  background-color: #222222 !important;
  color: #ffffff !important;
  border: 1px solid #595959 !important;
  border-radius: 0.75rem !important;
  color-scheme: dark !important;
}

textarea:focus,
textarea.form-input:focus {
  background-color: #2c2c2c !important;
  border-color: #ec1313 !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(236, 19, 19, 0.18) !important;
}

/* Placeholder color fix */
::placeholder {
  color: #595959 !important;
  opacity: 1 !important;
}
