/* AdsSpaceHub Sprint 3-19 - Theme Engine
   Carga al final del layout para normalizar componentes que todavía tenían CSS local. */
:root{
  --ash-surface:#ffffff;
  --ash-surface-2:#f8fafc;
  --ash-surface-3:#eef2ff;
  --ash-border:#e5e7eb;
  --ash-border-soft:rgba(148,163,184,.24);
  --ash-text-main:#0f172a;
  --ash-text-soft:#64748b;
  --ash-table-head:#f8fafc;
  --ash-input:#ffffff;
  --ash-input-border:#dfe5ee;
  --ash-shadow-soft:0 18px 50px rgba(15,23,42,.10);
}
html[data-theme="dark"]{
  --ash-surface:#0b1020;
  --ash-surface-2:#111827;
  --ash-surface-3:#172033;
  --ash-border:rgba(148,163,184,.18);
  --ash-border-soft:rgba(148,163,184,.14);
  --ash-text-main:#f8fafc;
  --ash-text-soft:#a9b4c7;
  --ash-table-head:#121a2d;
  --ash-input:#0f172a;
  --ash-input-border:rgba(148,163,184,.26);
  --ash-shadow-soft:0 22px 70px rgba(0,0,0,.35);
  color-scheme:dark;
}
html[data-theme="dark"],html[data-theme="dark"] body{background:#050816!important;color:var(--ash-text-main)!important;}
html[data-theme="dark"] .dash-body{background:#050816!important;}
html[data-theme="dark"] .dash-main{background:linear-gradient(180deg,#050816 0%,#080d1c 100%)!important;color:var(--ash-text-main)!important;}
html[data-theme="dark"] .sidebar{background:linear-gradient(180deg,#020617 0%,#081122 100%)!important;border-right:1px solid rgba(148,163,184,.13)!important;}
html[data-theme="dark"] .topbar,html[data-theme="dark"] .public-nav{background:rgba(11,16,32,.88)!important;border-color:var(--ash-border)!important;color:var(--ash-text-main)!important;}
html[data-theme="dark"] .brand{color:#fff!important;}
html[data-theme="dark"] .brand span{color:#a78bfa!important;}

/* Cards y contenedores generales */
html[data-theme="dark"] .ash-card,
html[data-theme="dark"] .card,
html[data-theme="dark"] .owner-kpi,
html[data-theme="dark"] .chart-card,
html[data-theme="dark"] .reservations-card,
html[data-theme="dark"] .booking-card,
html[data-theme="dark"] .detail-panel,
html[data-theme="dark"] .space-card,
html[data-theme="dark"] .package-card,
html[data-theme="dark"] .package-item,
html[data-theme="dark"] .quote-card,
html[data-theme="dark"] .campaign-card,
html[data-theme="dark"] .material-card,
html[data-theme="dark"] .evidence-card,
html[data-theme="dark"] .profile-card,
html[data-theme="dark"] .dashboard-wrapper,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .list-group-item{
  background:var(--ash-surface)!important;
  color:var(--ash-text-main)!important;
  border-color:var(--ash-border)!important;
  box-shadow:var(--ash-shadow-soft)!important;
}
html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .bg-light,
html[data-theme="dark"] .table-light,
html[data-theme="dark"] .text-bg-light{
  background-color:var(--ash-surface-2)!important;
  color:var(--ash-text-main)!important;
  border-color:var(--ash-border)!important;
}
html[data-theme="dark"] .border,html[data-theme="dark"] .border-top,html[data-theme="dark"] .border-bottom,html[data-theme="dark"] .border-start,html[data-theme="dark"] .border-end{border-color:var(--ash-border)!important;}

/* Texto */
html[data-theme="dark"] h1,html[data-theme="dark"] h2,html[data-theme="dark"] h3,html[data-theme="dark"] h4,html[data-theme="dark"] h5,html[data-theme="dark"] h6,
html[data-theme="dark"] .fw-bold,html[data-theme="dark"] .ash-section-title,html[data-theme="dark"] .section-title,html[data-theme="dark"] strong{color:var(--ash-text-main)!important;}
html[data-theme="dark"] .text-muted,html[data-theme="dark"] small,html[data-theme="dark"] .small,html[data-theme="dark"] .muted,
html[data-theme="dark"] .card-text,html[data-theme="dark"] .page-head p{color:var(--ash-text-soft)!important;}
html[data-theme="dark"] a:not(.btn):not(.sidebar a){color:#a78bfa;}

/* Tablas */
html[data-theme="dark"] .table{--bs-table-bg:transparent!important;--bs-table-color:var(--ash-text-main)!important;--bs-table-border-color:var(--ash-border)!important;color:var(--ash-text-main)!important;border-color:var(--ash-border)!important;}
html[data-theme="dark"] .table thead,html[data-theme="dark"] .table thead th{background:var(--ash-table-head)!important;color:#dbeafe!important;border-color:var(--ash-border)!important;}
html[data-theme="dark"] .table tbody tr,html[data-theme="dark"] .table tbody td,html[data-theme="dark"] .table tbody th{background:transparent!important;color:var(--ash-text-main)!important;border-color:var(--ash-border)!important;}
html[data-theme="dark"] .table-hover tbody tr:hover>*{background:rgba(124,58,237,.10)!important;color:#fff!important;}
html[data-theme="dark"] .table-responsive{border-color:var(--ash-border)!important;}

/* Formularios */
html[data-theme="dark"] .form-control,html[data-theme="dark"] .form-select,html[data-theme="dark"] textarea,html[data-theme="dark"] input,html[data-theme="dark"] select{
  background-color:var(--ash-input)!important;
  color:var(--ash-text-main)!important;
  border-color:var(--ash-input-border)!important;
}
html[data-theme="dark"] .form-control::placeholder,html[data-theme="dark"] textarea::placeholder{color:#6b7280!important;}
html[data-theme="dark"] .form-control:focus,html[data-theme="dark"] .form-select:focus{border-color:#8b5cf6!important;box-shadow:0 0 0 .25rem rgba(139,92,246,.18)!important;}
html[data-theme="dark"] .input-group-text{background:var(--ash-surface-2)!important;border-color:var(--ash-input-border)!important;color:var(--ash-text-soft)!important;}

/* Badges y estados */
html[data-theme="dark"] .badge:not(.text-bg-success):not(.text-bg-danger):not(.text-bg-warning):not(.text-bg-primary),
html[data-theme="dark"] .package-badge,
html[data-theme="dark"] .badge-dark-soft,
html[data-theme="dark"] .badge-purple{
  background:rgba(124,58,237,.18)!important;
  color:#c4b5fd!important;
  border:1px solid rgba(167,139,250,.25)!important;
}
html[data-theme="dark"] .badge-success-soft{background:rgba(16,185,129,.14)!important;color:#6ee7b7!important;}
html[data-theme="dark"] .badge-warning-soft{background:rgba(245,158,11,.16)!important;color:#fcd34d!important;}
html[data-theme="dark"] .badge-danger-soft{background:rgba(239,68,68,.16)!important;color:#fca5a5!important;}

/* Componentes específicos de inventario, paquetes, reservas y campañas */
html[data-theme="dark"] .space-admin-table img,html[data-theme="dark"] .reservation-row img{background:#111827!important;border-color:var(--ash-border)!important;}
html[data-theme="dark"] .fake-chart{background:repeating-linear-gradient(to bottom,transparent 0,transparent 57px,rgba(148,163,184,.10) 58px)!important;border-color:var(--ash-border)!important;}
html[data-theme="dark"] .detail-tags span,html[data-theme="dark"] .tabs-mini,html[data-theme="dark"] .detail-tabs{border-color:var(--ash-border)!important;}
html[data-theme="dark"] .detail-tags span{background:var(--ash-surface-2)!important;color:var(--ash-text-main)!important;}

/* Alertas */
html[data-theme="dark"] .alert-success{background:rgba(16,185,129,.14)!important;color:#86efac!important;border-color:rgba(16,185,129,.25)!important;}
html[data-theme="dark"] .alert-danger{background:rgba(239,68,68,.14)!important;color:#fca5a5!important;border-color:rgba(239,68,68,.25)!important;}
html[data-theme="dark"] .alert-warning{background:rgba(245,158,11,.14)!important;color:#fde68a!important;border-color:rgba(245,158,11,.25)!important;}
html[data-theme="dark"] .alert-info{background:rgba(59,130,246,.14)!important;color:#bfdbfe!important;border-color:rgba(59,130,246,.25)!important;}

/* Light mode normalization */
html[data-theme="light"] .ash-card,html[data-theme="light"] .card{background:#fff!important;color:#0f172a!important;}
