/* Estilos para actividades llenas */
.activity-full {
    opacity: 0.6;
    /* Le da un aspecto semi-transparente */
    position: relative;
    /* Necesario para el overlay */
    overflow: hidden;
    /* Evita que el overlay se salga */
}

.activity-full .card-body {
    pointer-events: none;
    /* Deshabilita clics en el contenido, excepto en el botón si no está disabled */
}

/* Aseguramos que el botón sí sea usable si no está disabled (ej: Gestionar Bajas) */
.activity-full .btn:not(:disabled) {
    pointer-events: auto;
}


.activity-full-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-20deg);
    /* Centra y rota el texto */
    background-color: rgba(220, 53, 69, 0.8);
    /* Rojo semi-transparente (Bootstrap 'danger') */
    color: white;
    padding: 10px 40px;
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    border: 2px solid white;
    border-radius: 5px;
    z-index: 10;
    /* Se asegura de que esté por encima del contenido */
    pointer-events: none;
    /* Permite hacer clic "a través" del overlay */
}

/* =========================================
   SISTEMA DE TEMAS REFINADO
   ========================================= */

/* --- 1. VARIABLES (Base Definition) --- */

/* AZUL */
[data-theme="azul"] {
    --theme-bg-body: #eff6ff;
    --theme-bg-card: #ffffff;
    --theme-border: #bfdbfe;
    --theme-text: #1e3a8a;
    --bs-primary: #3b82f6;
    --bs-primary-rgb: 59, 130, 246;
}

html[data-bs-theme="dark"] [data-theme="azul"],
[data-bs-theme="dark"][data-theme="azul"] {
    --theme-bg-body: #020617;
    /* Slate 950 - Very dark blue/black */
    --theme-bg-card: #0f172a;
    /* Slate 900 - Slightly lighter */
    /* Lighter than body */
    --theme-border: #1e293b;
    /* Slate 800 */
    --theme-text: #e2e8f0;
    /* Slate 200 */
    --bs-primary: #3b82f6;
    --bs-primary-rgb: 59, 130, 246;
}

/* VERDE */
[data-theme="verde"] {
    --theme-bg-body: #f0fdf4;
    --theme-bg-card: #ffffff;
    --theme-border: #bbf7d0;
    --theme-text: #14532d;
    --bs-primary: #22c55e;
    --bs-primary-rgb: 34, 197, 94;
}

html[data-bs-theme="dark"] [data-theme="verde"],
[data-bs-theme="dark"][data-theme="verde"] {
    --theme-bg-body: #052e16;
    --theme-bg-card: #14532d;
    --theme-border: #22c55e;
    --theme-text: #dcfce7;
    --bs-primary: #4ade80;
    --bs-primary-rgb: 74, 222, 128;
}

/* ROSA */
[data-theme="rosa"] {
    --theme-bg-body: #fdf2f8;
    --theme-bg-card: #ffffff;
    --theme-border: #fbcfe8;
    --theme-text: #831843;
    --bs-primary: #ec4899;
    --bs-primary-rgb: 236, 72, 153;
}

html[data-bs-theme="dark"] [data-theme="rosa"],
[data-bs-theme="dark"][data-theme="rosa"] {
    --theme-bg-body: #500724;
    --theme-bg-card: #831843;
    --theme-border: #ec4899;
    --theme-text: #fce7f3;
    --bs-primary: #f472b6;
    --bs-primary-rgb: 244, 114, 182;
}

/* NARANJA */
[data-theme="naranja"] {
    --theme-bg-body: #fff7ed;
    --theme-bg-card: #ffffff;
    --theme-border: #fed7aa;
    --theme-text: #7c2d12;
    --bs-primary: #f97316;
    --bs-primary-rgb: 249, 115, 22;
}

html[data-bs-theme="dark"] [data-theme="naranja"],
[data-bs-theme="dark"][data-theme="naranja"] {
    --theme-bg-body: #431407;
    --theme-bg-card: #7c2d12;
    --theme-border: #f97316;
    --theme-text: #ffedd5;
    --bs-primary: #fb923c;
    --bs-primary-rgb: 251, 146, 60;
}

/* LAVANDA */
[data-theme="lavanda"] {
    --theme-bg-body: #faf5ff;
    --theme-bg-card: #ffffff;
    --theme-border: #e9d5ff;
    --theme-text: #581c87;
    --bs-primary: #a855f7;
    --bs-primary-rgb: 168, 85, 247;
}

html[data-bs-theme="dark"] [data-theme="lavanda"],
[data-bs-theme="dark"][data-theme="lavanda"] {
    --theme-bg-body: #3b0764;
    --theme-bg-card: #581c87;
    --theme-border: #a855f7;
    --theme-text: #f3e8ff;
    --bs-primary: #c084fc;
    --bs-primary-rgb: 192, 132, 252;
}

/* TURQUESA */
[data-theme="turquesa"] {
    --theme-bg-body: #f0fdfa;
    --theme-bg-card: #ffffff;
    --theme-border: #99f6e4;
    --theme-text: #134e4a;
    --bs-primary: #14b8a6;
    --bs-primary-rgb: 20, 184, 166;
}

html[data-bs-theme="dark"] [data-theme="turquesa"],
[data-bs-theme="dark"][data-theme="turquesa"] {
    --theme-bg-body: #042f2e;
    --theme-bg-card: #134e4a;
    --theme-border: #14b8a6;
    --theme-text: #ccfbf1;
    --bs-primary: #2dd4bf;
    --bs-primary-rgb: 45, 212, 191;
}

/* OSCURO (Monochrome) */
[data-theme="oscuro"] {
    --theme-bg-body: #f8f9fa;
    --theme-bg-card: #ffffff;
    --theme-border: #dee2e6;
    --theme-text: #212529;
    --bs-primary: #212529;
    --bs-primary-rgb: 33, 37, 41;
}

html[data-bs-theme="dark"] [data-theme="oscuro"],
[data-bs-theme="dark"][data-theme="oscuro"] {
    --theme-bg-body: #000000;
    --theme-bg-card: #212529;
    --theme-border: #495057;
    --theme-text: #f8f9fa;
    --bs-primary: #f8f9fa;
    --bs-primary-rgb: 248, 249, 250;
}

/* --- 2. APPLICATION --- */

body {
    background-color: var(--theme-bg-body) !important;
    color: var(--theme-text) !important;
    transition: background-color 0.3s, color 0.3s;
}

.card {
    background-color: var(--theme-bg-card) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text) !important;
}

/* Headers matching text color */
h1,
h2,
h3,
h4,
h5,
h6,
.card-header {
    color: var(--theme-text) !important;
}

/* CRITICAL FIX: Override Tailwind gray text classes to ensure contrast against theme backgrounds */
.text-gray-400,
.text-gray-500,
.text-gray-600,
.text-gray-700,
.text-gray-800,
.text-gray-900 {
    color: var(--theme-text) !important;
}

/* Optional squish for hierarchy (lighter grays get slight opacity) */
.text-gray-400,
.text-gray-500,
.text-gray-600 {
    opacity: 0.85;
}

/* Inputs should match card style but distinguishable */
input,
select,
textarea,
.form-control,
.form-select {
    background-color: var(--theme-bg-card) !important;
    color: var(--theme-text) !important;
    border-color: var(--theme-border) !important;
}

/* Button overrides rely on --bs-primary which is set per theme */
.btn-primary {
    background-color: var(--bs-primary) !important;
    border-color: var(--bs-primary) !important;
}

.text-primary {
    color: var(--bs-primary) !important;
}

.bg-primary {
    background-color: var(--bs-primary) !important;
}

/* =========================================
   DARK MODE / THEME FIXES 
   (Global Overrides for Utility Classes)
   ========================================= */

[data-bs-theme="dark"] .bg-white,
[data-bs-theme="dark"] .bg-gray-50,
[data-bs-theme="dark"] .bg-gray-100,
[data-bs-theme="dark"] .bg-gray-200 {
    /* Force these light backgrounds to be transparent or theme-colored in dark mode */
    background-color: var(--theme-bg-card) !important;
    border-color: var(--theme-border) !important;
}

/* Fix for Colored Alerts/Backgrounds (bg-blue-50, etc.) in Dark Mode */
[data-bs-theme="dark"] .bg-blue-50 {
    background-color: rgba(59, 130, 246, 0.15) !important;
    color: #93c5fd !important;
    border-color: rgba(59, 130, 246, 0.3) !important;
}

[data-bs-theme="dark"] .bg-green-50 {
    background-color: rgba(34, 197, 94, 0.15) !important;
    color: #86efac !important;
    border-color: rgba(34, 197, 94, 0.3) !important;
}

[data-bs-theme="dark"] .bg-yellow-50 {
    background-color: rgba(234, 179, 8, 0.15) !important;
    color: #fde047 !important;
    border-color: rgba(234, 179, 8, 0.3) !important;
}

[data-bs-theme="dark"] .bg-red-50 {
    background-color: rgba(239, 68, 68, 0.15) !important;
    color: #fca5a5 !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

[data-bs-theme="dark"] .bg-indigo-50 {
    background-color: rgba(99, 102, 241, 0.15) !important;
    color: #a5b4fc !important;
    border-color: rgba(99, 102, 241, 0.3) !important;
}

[data-bs-theme="dark"] .bg-purple-50 {
    background-color: rgba(168, 85, 247, 0.15) !important;
    color: #d8b4fe !important;
    border-color: rgba(168, 85, 247, 0.3) !important;
}

/* In dark mode, ensure text inside these alerts is readable */
[data-bs-theme="dark"] .bg-blue-50 .text-blue-800,
[data-bs-theme="dark"] .bg-blue-50 .text-blue-700 {
    color: #bfdbfe !important;
}

[data-bs-theme="dark"] .bg-green-50 .text-green-800,
[data-bs-theme="dark"] .bg-green-50 .text-green-700 {
    color: #bbf7d0 !important;
}

[data-bs-theme="dark"] .bg-yellow-50 .text-yellow-800,
[data-bs-theme="dark"] .bg-yellow-50 .text-yellow-700 {
    color: #fef08a !important;
}

[data-bs-theme="dark"] .bg-red-50 .text-red-800,
[data-bs-theme="dark"] .bg-red-50 .text-red-700 {
    color: #fecaca !important;
}

/* Fix for HOVER states in Dark Mode 
   (Prevent light gray hover on dark text) */
[data-bs-theme="dark"] .hover\:bg-gray-50:hover,
[data-bs-theme="dark"] .hover\:bg-gray-100:hover,
[data-bs-theme="dark"] tr:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
    /* Subtle white tint */
    color: var(--theme-text) !important;
}

/* Fix for striped tables if used */
[data-bs-theme="dark"] .table-striped>tbody>tr:nth-of-type(odd)>* {
    background-color: rgba(255, 255, 255, 0.02) !important;
    color: var(--theme-text) !important;
}