/* ========================================
   LOGIN
   ======================================== */

/* --- Fondo con degradado sutil y patrón --- */
.login-page-wrapper {
    background: linear-gradient(135deg, #e0e9ff 0%, #f0f4ff 100%);
    position: relative;
    min-height: 100vh;
}

/* Efecto de burbujas o círculos decorativos en el fondo */
.login-page-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(93, 135, 255, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.login-page-wrapper::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(93, 135, 255, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

/* --- Mejora de la tarjeta de login --- */
.login-card {
    border: none !important;
    border-radius: 20px !important;
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.5) inset !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    padding: 2rem 2.5rem !important;
    /* Ajusta el padding interno */
}

.login-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.8) inset !important;
}

/* --- Logo --- */
.login-logo {
    margin-bottom: 1.5rem !important;
}

.login-logo img {
    max-height: 60px;
    /* Ajusta el tamaño del logo */
    width: auto;
}

/* --- Títulos y textos --- */
.login-title {
    font-size: 1.75rem !important;
    font-weight: 700 !important;
    color: #2a3547 !important;
    margin-bottom: 0.5rem !important;
}

.login-subtitle {
    font-size: 0.95rem !important;
    color: #7c8fac !important;
    margin-bottom: 2rem !important;
}

/* --- Campos de formulario mejorados --- */
.login-card .form-control {
    background-color: #f8faff !important;
    border: 1.5px solid #e9edf4 !important;
    border-radius: 12px !important;
    padding: 12px 16px !important;
    font-size: 0.95rem !important;
    transition: all 0.3s ease !important;
    color: #2a3547 !important;
}

.login-card .form-control:focus {
    background-color: #ffffff !important;
    border-color: #5d87ff !important;
    box-shadow: 0 0 0 4px rgba(93, 135, 255, 0.15) !important;
}

.login-card .form-control::placeholder {
    color: #a0b3c9 !important;
    font-weight: 300 !important;
}

/* --- Estilos para etiquetas --- */
.login-card .form-label {
    font-weight: 600 !important;
    font-size: 0.85rem !important;
    color: #2a3547 !important;
    margin-bottom: 0.4rem !important;
}

/* --- Checkbox "Recordarme" --- */
.login-card .form-check-input {
    border-radius: 6px !important;
    border: 1.5px solid #d0d8e6 !important;
    width: 1.2em !important;
    height: 1.2em !important;
    margin-top: 0.1em !important;
    transition: all 0.2s ease !important;
}

.login-card .form-check-input:checked {
    background-color: #5d87ff !important;
    border-color: #5d87ff !important;
}

.login-card .form-check-label {
    font-size: 0.9rem !important;
    color: #5a6a85 !important;
}

/* --- Botón de acceso mejorado --- */
.btn-login {
    background: linear-gradient(135deg, #5d87ff 0%, #4a6ccc 100%) !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 14px 20px !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    color: #ffffff !important;
    box-shadow: 0 8px 16px -6px rgba(93, 135, 255, 0.4) !important;
    transition: all 0.3s ease !important;
    letter-spacing: 0.3px !important;
}

.btn-login:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 12px 24px -8px rgba(93, 135, 255, 0.5) !important;
    background: linear-gradient(135deg, #4a6ccc 0%, #3b5eb3 100%) !important;
}

.btn-login:active {
    transform: scale(0.98) !important;
    box-shadow: 0 4px 12px -4px rgba(93, 135, 255, 0.4) !important;
}

/* --- Enlace "Olvidaste contraseña?" --- */
.login-links a {
    color: #5d87ff !important;
    font-weight: 500 !important;
    font-size: 0.9rem !important;
    text-decoration: none !important;
    transition: color 0.2s ease !important;
}

.login-links a:hover {
    color: #3b5eb3 !important;
    text-decoration: underline !important;
}

/* --- Separador o línea decorativa (opcional) --- */
.login-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e9edf4;
}

.login-divider span {
    padding: 0 1rem;
    font-size: 0.8rem;
    color: #a0b3c9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .login-card {
        padding: 1.5rem !important;
        border-radius: 16px !important;
    }

    .login-title {
        font-size: 1.5rem !important;
    }

    .login-page-wrapper::before,
    .login-page-wrapper::after {
        display: none;
        /* Oculta los círculos decorativos en móvil */
    }
}

/* ============================================= */
/* TEMA CLARO Y OSCURO */
/* ============================================= */

/* Transición suave al cambiar de tema */
html {
    transition: background-color 0.3s ease, color 0.3s ease;
}

html * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Excluir ciertos elementos de la transición para mejor rendimiento */
html .topbar,
html .left-sidebar,
html .card {
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Estilos para el ícono de tema */
.nav-icon-hover-bg .dark-layout,
.nav-icon-hover-bg .light-layout {
    cursor: pointer;
    border-radius: 50%;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.nav-icon-hover-bg .dark-layout:hover,
.nav-icon-hover-bg .light-layout:hover {
    background-color: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
}

/* Asegurar que los íconos tengan el tamaño correcto */
.nav-icon-hover-bg .ti-moon,
.nav-icon-hover-bg .ti-sun {
    font-size: 1.2rem;
}

/* ============================================= */
/* SIDEBAR - ASEGURAMIENTO WEB */
/* ============================================= */

.left-sidebar {
    transition: width 0.3s ease-in-out, left 0.3s ease-in-out !important;
}

.page-wrapper {
    transition: margin-left 0.3s ease-in-out !important;
}

.topbar {
    transition: width 0.3s ease-in-out, left 0.3s ease-in-out !important;
}

/* ============================================= */
/* MODO MINI - DESKTOP (> 1300px) */
/* ============================================= */

body.mini-sidebar .hide-menu {
    display: none !important;
}

body.mini-sidebar .nav-small-cap span {
    display: none !important;
}

body.mini-sidebar .nav-small-cap .nav-small-cap-icon {
    display: inline-block !important;
}

body.mini-sidebar .logo-img {
    overflow: hidden !important;
}

body.mini-sidebar .sidebar-nav .has-arrow::after {
    display: none !important;
}

body.mini-sidebar .sidebar-item .sidebar-link {
    justify-content: center !important;
    padding: 11px 9px !important;
}

/* Hover: expandir el sidebar en desktop */
body.mini-sidebar .left-sidebar:hover {
    width: 270px !important;
    min-width: 270px !important;
    z-index: 100 !important;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12) !important;
}

body.mini-sidebar .left-sidebar:hover .hide-menu {
    display: inline-block !important;
}

body.mini-sidebar .left-sidebar:hover .nav-small-cap span {
    display: inline !important;
}

body.mini-sidebar .left-sidebar:hover .sidebar-nav .has-arrow::after {
    display: inline-block !important;
}

body.mini-sidebar .left-sidebar:hover .sidebar-item .sidebar-link {
    justify-content: flex-start !important;
    padding: 11px 15px !important;
}

body.mini-sidebar .left-sidebar:hover .badge {
    display: inline-block !important;
}

/* ============================================= */
/* MODO MÓVIL - OVERLAY (< 1300px) */
/* ============================================= */

@media (max-width: 1299.98px) {
    /* El sidebar se oculta a la izquierda */
    .left-sidebar {
        left: -270px !important;
        width: 270px !important;
        min-width: 270px !important;
        position: fixed !important;
        height: 100% !important;
        z-index: 99 !important;
        transition: left 0.3s ease-in-out !important;
        box-shadow: none;
    }

    /* Cuando está abierto, se muestra */
    body.show-sidebar .left-sidebar {
        left: 0 !important;
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    }

    /* El contenido NO se comprime */
    .page-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .topbar {
        width: 100% !important;
        left: 0 !important;
    }

    /* Ocultar textos en móvil siempre (ya que el sidebar se abre/cierra completo) */
    .hide-menu {
        display: inline-block !important;
    }

    /* Asegurar que el body no tenga márgenes extraños */
    body {
        overflow-x: hidden !important;
    }
}

/* ============================================= */
/* OVERLAY OSCURO PARA MÓVIL */
/* ============================================= */

.dark-transparent {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 98;
    display: none;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

/* Mostrar overlay cuando sidebar está abierto en móvil */
body.show-sidebar .dark-transparent {
    display: block !important;
    opacity: 1;
}

/* En móvil, el overlay aparece al abrir el sidebar */
@media (max-width: 1299.98px) {
    body.show-sidebar .dark-transparent {
        display: block !important;
        opacity: 1;
    }
}

/* ============================================= */
/* RESPONSIVE - Ajustes generales */
/* ============================================= */

/* Si no hay show-sidebar, el overlay no se muestra */
body:not(.show-sidebar) .dark-transparent {
    display: none !important;
    opacity: 0 !important;
}

/* Estilo para el nombre de usuario en el header */
.user-name h6 {
    color: var(--bs-heading-color);
    font-weight: 600;
}

.user-name p {
    color: var(--bs-body-color);
    opacity: 0.7;
}

/* En modo mobile, ocultar el nombre */
@media (max-width: 767.98px) {
    .user-name {
        display: none !important;
    }
}

/* Estilos para el autocomplete */
.ui-autocomplete {
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1050 !important;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.ui-autocomplete .ui-menu-item {
    padding: 6px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.ui-autocomplete .ui-menu-item:hover {
    background: #f0f5ff;
}

.ui-autocomplete .ui-menu-item .text-muted {
    font-size: 0.8rem;
    color: #888;
}

/* ============================================
   UPLOAD AREA SIMPLE
   ============================================ */

.upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-area:hover {
    border-color: #5d87ff;
    background: #F2F3FF;
}

.upload-area.dragover {
    border-color: #F79D0F;
    background: #fff8f0;
}

.upload-area .file-selected {
    width: 100%;
}

.upload-area .file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    width: 100%;
}

.upload-area .file-icon {
    color: #F79D0F;
}

.upload-area .file-details {
    flex: 1;
    text-align: left;
}

.upload-area .file-name {
    display: block;
    font-weight: 600;
    color: #212529;
}

.upload-area .file-size {
    font-size: 0.8rem;
}

.severidad-critico {
    background-color: #f8d7da;
    border-left: 4px solid #dc3545;
}

.severidad-advertencia {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
}

.severidad-info {
    background-color: #d1ecf1;
    border-left: 4px solid #17a2b8;
}

.resumen-card {
    transition: all 0.3s ease;
}

.resumen-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.calendario-produccion td {
    min-width: 60px;
    height: 50px;
    vertical-align: middle;
}

.calendario-produccion td:hover {
    opacity: 0.8;
    transition: opacity 0.2s;
}

#buscadorHistorial:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}