:root {
    --rose-50: #fff5f7;
    --rose-100: #fce7ec;
    --rose-200: #fbcfe0;
    --rose-300: #f8a8c6;
    --rose-400: #f27ba3;
    --rose-500: #e84d86;
    --rose-600: #d42d66;
    --rose-700: #b21e4f;
    --rose-800: #921c43;
    --rose-900: #781b3b;

    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --bg: var(--white);
    --bg-soft: var(--rose-50);
    --card: var(--white);
    --card-solid: var(--white);
    --elevated: var(--gray-50);
    --text: var(--gray-800);
    --text-muted: var(--gray-500);
    --border: var(--rose-200);
    --shadow: rgba(216, 112, 147, 0.10);
    --shadow-strong: rgba(216, 112, 147, 0.18);

    --primary: var(--rose-600);
    --primary-dark: var(--rose-700);
    --primary-light: var(--rose-400);
    --success: #7cb342;
    --danger: #e57373;
    --warning: #ffb74d;
    --info: #64b5f6;

    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --radius-xs: 8px;

    /* Bootstrap variable overrides */
    --bs-primary: var(--primary);
    --bs-primary-rgb: 212, 45, 102;
    --bs-success: var(--success);
    --bs-success-rgb: 124, 179, 66;
    --bs-danger: var(--danger);
    --bs-danger-rgb: 229, 115, 115;
    --bs-warning: var(--warning);
    --bs-warning-rgb: 255, 183, 77;
    --bs-info: var(--info);
    --bs-info-rgb: 100, 181, 246;
    --bs-body-bg: var(--bg-soft);
    --bs-body-color: var(--text);
    --bs-border-color: var(--border);
}

html[data-bs-theme="dark"] {
    --bg: #1a1518;
    --bg-soft: #2a1e23;
    --card: #241a1e;
    --card-solid: #241a1e;
    --elevated: #2f2228;
    --text: #f3e8ec;
    --text-muted: #bfaab2;
    --border: #4a2e38;
    --shadow: rgba(0, 0, 0, 0.30);
    --shadow-strong: rgba(0, 0, 0, 0.45);
    --primary: #f27ba3;
    --primary-dark: #f8a8c6;
    --primary-light: #e84d86;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(160deg, #fff9fb 0%, #fdf1f6 45%, #f8f0fa 100%);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

html[data-bs-theme="dark"] body {
    background: linear-gradient(160deg, #1b1417 0%, #221820 50%, #1a1418 100%);
}

/* ---------- Glass (sin filtros: solo color + borde + brillo) ---------- */
.glass,
.navbar,
.login-card,
.module-card {
    background: rgba(255, 255, 255, 0.78) !important;
    border: 1px solid rgba(255, 255, 255, 0.9) !important;
    border-top-color: #fff !important;
    border-left-color: rgba(255, 255, 255, 0.95) !important;
    box-shadow:
        0 6px 18px rgba(180, 60, 110, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

html[data-bs-theme="dark"] .glass,
html[data-bs-theme="dark"] .navbar,
html[data-bs-theme="dark"] .login-card,
html[data-bs-theme="dark"] .module-card {
    background: rgba(45, 32, 40, 0.88) !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25) !important;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

/* ---------- Navbar ---------- */
.navbar {
    background: rgba(255, 255, 255, 0.82) !important;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 14px rgba(180, 60, 110, 0.08);
    margin: 1rem auto 1.5rem;
    padding: 0.75rem 1.25rem;
    max-width: 1400px;
    width: calc(100% - 2rem);
}

html[data-bs-theme="dark"] .navbar {
    background: rgba(48, 34, 42, 0.68) !important;
    border-color: rgba(255, 255, 255, 0.14);
}

.navbar-brand {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    color: var(--primary) !important;
    font-size: 1.35rem;
}

.navbar-text {
    color: var(--text-muted);
    font-weight: 500;
}

.nav-link {
    font-weight: 500;
    color: var(--text) !important;
    border-radius: var(--radius-xs);
    padding: 0.5rem 0.85rem !important;
    margin-right: 0.15rem;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-link:hover,
.nav-link.active {
    background: var(--bg-soft);
    color: var(--primary) !important;
}

/* ---------- Buttons ---------- */
.btn {
    border-radius: var(--radius-xs);
    font-weight: 600;
    transition: transform 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px var(--shadow-strong);
    color: #fff;
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    transform: translateY(-1px);
}

.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #689f38; border-color: #689f38; color: #fff; }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #ef5350; border-color: #ef5350; color: #fff; }

.btn-warning { background: var(--warning); border-color: var(--warning); color: var(--gray-900); }
.btn-warning:hover { background: #ffa726; border-color: #ffa726; color: var(--gray-900); }

.btn-outline-secondary {
    color: var(--text-muted);
    border-color: var(--border);
}

.btn-outline-secondary:hover {
    background: var(--bg-soft);
    color: var(--primary);
    border-color: var(--primary-light);
}

.btn-lg {
    border-radius: var(--radius-md);
    padding: 0.85rem 1.5rem;
}

.btn-sm {
    border-radius: var(--radius-xs);
}

/* ---------- Cards (sin backdrop-filter: se anima solo transform) ---------- */
.card {
    background: rgba(255, 255, 255, 0.82) !important;
    border: 1px solid rgba(255, 255, 255, 0.85) !important;
    border-top-color: #fff !important;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 12px rgba(180, 60, 110, 0.07) !important;
    transition: transform 0.15s ease;
}

.card:hover {
    transform: translateY(-2px);
}

html[data-bs-theme="dark"] .card {
    background: rgba(45, 32, 40, 0.88) !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
}

.card-header {
    background: rgba(255, 255, 255, 0.35) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.55);
    padding: 1.25rem 1.5rem;
}

html[data-bs-theme="dark"] .card-header {
    background: rgba(255, 255, 255, 0.05) !important;
    border-bottom-color: rgba(255, 255, 255, 0.12);
}

.card-body {
    padding: 1.5rem;
}

/* ---------- Forms ---------- */
.form-control,
.form-select {
    background: rgba(255, 255, 255, 0.72);
    border: 1.5px solid rgba(255, 255, 255, 0.9);
    border-radius: var(--radius-xs);
    color: var(--text);
    font-weight: 400;
    box-shadow: inset 0 1px 2px rgba(180, 60, 110, 0.06);
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

html[data-bs-theme="dark"] .form-control,
html[data-bs-theme="dark"] .form-select {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.16);
    color: var(--text);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-light);
    box-shadow:
        0 0 0 0.25rem rgba(216, 112, 147, 0.15),
        inset 0 1px 2px rgba(180, 60, 110, 0.06);
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
}

html[data-bs-theme="dark"] .form-control:focus,
html[data-bs-theme="dark"] .form-select:focus {
    background: rgba(255, 255, 255, 0.12);
}

.form-label {
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.form-control-lg {
    border-radius: var(--radius-sm);
}

.input-group-text {
    background: var(--bg-soft);
    border-color: var(--border);
    color: var(--text-muted);
}

/* ---------- Tables ---------- */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-hover-bg: rgba(248, 168, 198, 0.14);
}

.table thead th {
    background: rgba(255, 255, 255, 0.45);
    color: var(--primary-dark);
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.7);
    border-top: none;
}

html[data-bs-theme="dark"] .table thead th {
    background: rgba(255, 255, 255, 0.06);
    border-bottom-color: rgba(255, 255, 255, 0.12);
}

.table-hover tbody tr:hover {
    background: rgba(248, 168, 198, 0.14);
}

.table-responsive {
    border-radius: var(--radius-md);
}

/* ---------- Alerts / Toasts ---------- */
.alert {
    border-radius: var(--radius-md);
    border-width: 1.5px;
}

.alert-warning {
    background: #fff8e1;
    border-color: var(--warning);
    color: #8a6d0b;
}

.alert-danger {
    background: #ffebee;
    border-color: var(--danger);
    color: #8b2e2e;
}

.alert-info {
    background: #e3f2fd;
    border-color: var(--info);
    color: #154c79;
}

.alert-success {
    background: #f1f8e9;
    border-color: var(--success);
    color: #4a6a1e;
}

.toast {
    border-radius: var(--radius-md);
    border: none;
    box-shadow: 0 8px 24px var(--shadow-strong);
}

/* ---------- Badges ---------- */
.badge {
    font-weight: 600;
    border-radius: 50rem;
    padding: 0.45em 0.85em;
}

/* ---------- Pagination ---------- */
.page-link {
    color: var(--primary);
    border-color: var(--border);
    border-radius: var(--radius-xs);
}

.page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
}

.page-link:hover {
    background: var(--bg-soft);
    color: var(--primary-dark);
    border-color: var(--primary-light);
}

/* ---------- Dropdowns ---------- */
.dropdown-menu {
    border-radius: var(--radius-md);
    padding: 0.4rem;
}

.dropdown-item {
    border-radius: var(--radius-xs);
    font-weight: 500;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: rgba(248, 168, 198, 0.22);
    color: var(--primary);
}

/* ---------- Selector de módulos ---------- */
.selector-container {
    background: transparent;
    min-height: 100vh;
}

.module-card {
    background: rgba(255, 255, 255, 0.82) !important;
    border: 1px solid rgba(255, 255, 255, 0.9) !important;
    border-top-color: #fff !important;
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem;
    transition: transform 0.15s ease;
    height: 100%;
    box-shadow: 0 6px 18px rgba(180, 60, 110, 0.08);
}

.module-card:hover {
    transform: translateY(-4px);
}

.module-card .display-1 {
    color: var(--primary);
}

.module-card .card-title {
    font-family: 'Playfair Display', serif;
    color: var(--text);
}

.module-card .card-text {
    color: var(--text-muted);
}

/* ---------- Almacén ---------- */
.area-card {
    border-radius: var(--radius-lg);
    transition: transform 0.15s ease;
    background: rgba(255, 255, 255, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 4px 12px rgba(180, 60, 110, 0.07);
}

.area-card:hover {
    transform: translateY(-3px);
}

.area-card .display-5 {
    color: var(--primary);
}

/* ---------- Login ---------- */
.login-card {
    background: rgba(255, 255, 255, 0.85) !important;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.95) !important;
    box-shadow: 0 8px 24px rgba(180, 60, 110, 0.09);
}

html[data-bs-theme="dark"] .login-card,
html[data-bs-theme="dark"] .area-card {
    background: rgba(48, 34, 42, 0.88) !important;
    border-color: rgba(255, 255, 255, 0.16) !important;
}

/* ---------- Images ---------- */
.img-thumbnail {
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(180, 60, 110, 0.08);
}

/* ---------- Monitoreo ---------- */
.kpi-card {
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.9) !important;
    transition: transform 0.15s ease;
}

.kpi-card:hover {
    transform: translateY(-3px);
}

.nav-tabs .nav-link {
    color: var(--text-muted);
    border: none;
    border-bottom: 2px solid transparent;
    font-weight: 600;
}

.nav-tabs .nav-link.active {
    color: var(--primary);
    background: transparent;
    border-bottom-color: var(--primary);
}

/* ---------- Utilities ---------- */
.text-primary { color: var(--primary) !important; }
.bg-primary { background-color: var(--primary) !important; }
.border-primary { border-color: var(--primary) !important; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .navbar {
        margin: 0.5rem auto 1rem;
        width: calc(100% - 1rem);
        border-radius: var(--radius-md);
    }

    h1, h2 {
        font-size: 1.5rem;
    }

    .module-card {
        padding: 1.5rem 1rem;
    }

    .card-body {
        padding: 1.25rem;
    }
}

/* Accesibilidad / rendimiento: sin movimiento si el sistema lo pide */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
