/**
 * Huden — estilos base que consumen variables del tema activo.
 */

html[data-huden-theme],
html[data-huden-theme] body {
    font-family: var(--huden-font-family, 'Segoe UI', Arial, Helvetica, sans-serif);
    color: var(--huden-text, #e5e7eb);
}

html[data-huden-theme] body {
    background: var(--huden-bg-page, #0f172a);
}

html[data-huden-theme] body.client-portal-body {
    background: var(--huden-bg-page-gradient, var(--huden-bg-page, #020617));
    color: var(--huden-text, #e5e7eb);
}

html[data-huden-theme] .sidebar {
    background: var(--huden-bg-sidebar, #1f2937) !important;
    color: var(--huden-text-inverse, #fff);
}

html[data-huden-theme] .navbar-top {
    background: var(--huden-bg-navbar, #fff) !important;
    border-bottom-color: var(--huden-border, #e5e7eb) !important;
    color: var(--huden-text, #111827);
}

html[data-huden-theme] .content {
    background: transparent;
    color: var(--huden-text, #111827);
}

html[data-huden-theme] .brand-title {
    color: var(--huden-text, #111827);
}

html[data-huden-theme] .brand-sub,
html[data-huden-theme] .text-secondary,
html[data-huden-theme] .text-muted {
    color: var(--huden-text-muted, #64748b) !important;
}

html[data-huden-theme] .user-badge {
    background: var(--huden-accent-soft, #f1f5f9);
    color: var(--huden-text, #334155);
}

html[data-huden-theme] .card-vcc,
html[data-huden-theme] .app-card {
    background: var(--huden-bg-card, #020617) !important;
    border: 1px solid var(--huden-border, rgba(255, 255, 255, 0.08));
    color: var(--huden-text, #e5e7eb);
    box-shadow: var(--huden-shadow, 0 20px 40px rgba(0, 0, 0, 0.35));
}

html[data-huden-theme] .card-dashboard {
    background: var(--huden-bg-card-alt, #ffffff) !important;
    border-color: var(--huden-border, #e2e8f0) !important;
    color: var(--huden-text, #111827);
}

html[data-huden-theme] .card-header-vcc {
    background: var(--huden-bg-surface-alt, linear-gradient(145deg, #020617, #0f172a)) !important;
    border-color: var(--huden-border, #1e293b) !important;
    color: var(--huden-text, #e5e7eb);
}

html[data-huden-theme] .agreement-container {
    background: var(--huden-bg-card, #0f172a) !important;
    border-color: var(--huden-border, #1e293b) !important;
}

html[data-huden-theme] .scroll-content,
html[data-huden-theme] .header-box {
    background: var(--huden-bg-surface, #1e293b) !important;
}

html[data-huden-theme] .legal-text {
    color: var(--huden-text, #cbd5e1);
}

html[data-huden-theme] .login-box {
    background: var(--huden-bg-login-box, rgba(2, 6, 23, 0.96)) !important;
    border: 1px solid var(--huden-border, rgba(148, 163, 184, 0.14));
    color: var(--huden-text, #e5e7eb);
}

html[data-huden-theme] body.login-page-body {
    background: var(--huden-bg-page-gradient, radial-gradient(circle at top, #1e293b 0%, #0f172a 45%, #020617 100%)) !important;
}

html[data-huden-theme] .form-control,
html[data-huden-theme] .form-select,
html[data-huden-theme] textarea.form-control {
    background-color: var(--huden-bg-input, #0f172a) !important;
    border-color: var(--huden-border, #334155) !important;
    color: var(--huden-text, #f8fafc) !important;
}

html[data-huden-theme] .form-control:focus,
html[data-huden-theme] .form-select:focus {
    border-color: var(--huden-accent, #38bdf8) !important;
    box-shadow: 0 0 0 0.2rem var(--huden-accent-ring, rgba(56, 189, 248, 0.2)) !important;
}

html[data-huden-theme] .form-label,
html[data-huden-theme] label {
    color: var(--huden-text, #e5e7eb);
}

html[data-huden-theme] .input-group-text {
    background: var(--huden-bg-input, #0f172a);
    border-color: var(--huden-border, #334155);
    color: var(--huden-text-muted, #94a3b8);
}

html[data-huden-theme] .btn-primary {
    background: var(--huden-accent, #2563eb) !important;
    border-color: var(--huden-accent, #2563eb) !important;
    color: var(--huden-btn-primary-text, #fff) !important;
}

html[data-huden-theme] .btn-primary:hover,
html[data-huden-theme] .btn-primary:focus {
    background: var(--huden-accent-hover, #1d4ed8) !important;
    border-color: var(--huden-accent-hover, #1d4ed8) !important;
}

html[data-huden-theme] .btn-outline-primary {
    color: var(--huden-accent, #2563eb) !important;
    border-color: var(--huden-accent, #2563eb) !important;
}

html[data-huden-theme] .btn-outline-primary:hover {
    background: var(--huden-accent, #2563eb) !important;
    color: var(--huden-btn-primary-text, #fff) !important;
}

html[data-huden-theme] .btn-info {
    background: var(--huden-accent, #0ea5e9) !important;
    border-color: var(--huden-accent, #0ea5e9) !important;
}

html[data-huden-theme] a {
    color: var(--huden-link, var(--huden-accent, #38bdf8));
}

html[data-huden-theme] .sidebar .nav-link {
    color: var(--huden-sidebar-link, rgba(255, 255, 255, 0.85));
}

html[data-huden-theme] .sidebar .nav-link:hover,
html[data-huden-theme] .sidebar .nav-link.active {
    color: var(--huden-sidebar-link-active, var(--huden-accent, #fbbf24));
    background: var(--huden-sidebar-link-active-bg, rgba(255, 255, 255, 0.06));
}

html[data-huden-theme] .modal-content {
    background: var(--huden-bg-card, #1e293b);
    color: var(--huden-text, #e5e7eb);
    border-color: var(--huden-border, #334155);
}

html[data-huden-theme] .modal-header,
html[data-huden-theme] .modal-footer {
    border-color: var(--huden-border, #334155);
}

html[data-huden-theme] .table {
    color: var(--huden-text, inherit);
}

html[data-huden-theme] .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: var(--huden-table-stripe, rgba(255, 255, 255, 0.03));
}

html[data-huden-theme] .alert-light {
    background: var(--huden-bg-card-alt, #f8fafc);
    border-color: var(--huden-border, #e2e8f0);
    color: var(--huden-text, #334155);
}

html[data-huden-theme] h1,
html[data-huden-theme] h2,
html[data-huden-theme] h3,
html[data-huden-theme] h4,
html[data-huden-theme] h5,
html[data-huden-theme] h6 {
    color: var(--huden-heading, var(--huden-text, inherit));
}

/* Barra de vista previa (?theme_preview= en URL) */
.huden-theme-preview-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: linear-gradient(90deg, #1e40af, #2563eb);
    color: #fff;
    font-size: 0.9rem;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.35);
}

html[data-huden-theme-preview="1"] body {
    padding-top: 48px;
}

.huden-theme-preview-bar__close {
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
}

.huden-theme-preview-bar__close:hover {
    background: rgba(255, 255, 255, 0.28);
}
