/* mejoras.css - Modo Oscuro + Responsive mejorado */

/* Variables de colores */
:root {
    --bg-primary: #f9fafb;
    --bg-secondary: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --accent-color: #2563eb;
}

[data-theme="dark"] {
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --border-color: #374151;
    --accent-color: #3b82f6;
}

/* Aplicar variables */
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s, color 0.3s;
}

.bg-white {
    background-color: var(--bg-secondary) !important;
}

.bg-gray-50 {
    background-color: var(--bg-primary) !important;
}

.text-gray-900 {
    color: var(--text-primary) !important;
}

.text-gray-600, .text-gray-500 {
    color: var(--text-secondary) !important;
}

.border-gray-200 {
    border-color: var(--border-color) !important;
}

/* Botón toggle dark mode */
#darkModeToggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

#darkModeToggle:hover {
    transform: scale(1.1);
}

/* Responsive mejorado */
@media (max-width: 768px) {
    /* Sidebar colapsable en móvil */
    aside {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        z-index: 999;
        transition: left 0.3s;
    }

    aside.mobile-open {
        left: 0;
    }

    /* Botón hamburguesa */
    #mobileMenuBtn {
        position: fixed;
        top: 20px;
        left: 20px;
        z-index: 1000;
        width: 40px;
        height: 40px;
        background: var(--accent-color);
        color: white;
        border: none;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

    /* Ajustar padding en móvil */
    main {
        padding: 1rem !important;
    }

    .p-8 {
        padding: 1rem !important;
    }

    /* Tablas responsive */
    .overflow-x-auto {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 800px;
    }

    /* Cards en columna */
    .grid {
        grid-template-columns: 1fr !important;
    }

    /* Modales en móvil */
    .modal-content {
        width: 95% !important;
        margin: 10px;
    }

    /* Texto más pequeño en móvil */
    .text-2xl {
        font-size: 1.5rem !important;
    }

    .text-3xl {
        font-size: 1.875rem !important;
    }
}

@media (max-width: 640px) {
    /* Ajustes adicionales para pantallas muy pequeñas */
    .px-6 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .gap-4 {
        gap: 0.75rem !important;
    }

    /* Botones apilados */
    .flex.gap-3 {
        flex-direction: column;
    }

    .flex.gap-3 > * {
        width: 100%;
    }
}

/* Overlay para sidebar móvil */
#mobileOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

#mobileOverlay.active {
    display: block;
}

/* Mejoras de accesibilidad */
*:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Animaciones suaves */
* {
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Modo oscuro para inputs */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background-color: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

[data-theme="dark"] input::placeholder {
    color: #9ca3af;
}

/* Modo oscuro para tablas */
[data-theme="dark"] .bg-gray-50 {
    background-color: #1f2937 !important;
}

[data-theme="dark"] .hover\:bg-gray-50:hover {
    background-color: #374151 !important;
}

/* Modo oscuro para badges */
[data-theme="dark"] .bg-blue-100 {
    background-color: #1e3a8a !important;
}

[data-theme="dark"] .bg-green-100 {
    background-color: #14532d !important;
}

[data-theme="dark"] .bg-yellow-100 {
    background-color: #713f12 !important;
}

[data-theme="dark"] .bg-red-100 {
    background-color: #7f1d1d !important;
}

[data-theme="dark"] .bg-gray-100 {
    background-color: #374151 !important;
}