/* --- 1. ESTILOS GENERALES Y RESET --- */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    padding: 0;
    color: #2c3e50;
}

header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

header h1 { margin: 0; font-size: 1.8em; }

/* --- 2. MENÚ PRINCIPAL --- */
.menu-principal ul {
    list-style: none;
    padding: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
}

.menu-principal a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background 0.3s;
}

.menu-principal a:hover {
    background: rgba(255,255,255,0.1);
    text-decoration: none;
}

/* --- 3. DASHBOARD (TARJETAS E INDICADORES) --- */
.dashboard-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    padding: 0 20px;
    margin-bottom: 30px;
}

.card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: center;
    border-top: 5px solid #3498db;
}

.card h3 { margin: 0; font-size: 0.85em; color: #7f8c8d; text-transform: uppercase; letter-spacing: 1px; }
.card p { margin: 10px 0 0; font-size: 2em; font-weight: bold; color: #2c3e50; }

.card.urgent { border-top-color: #e74c3c; }
.card.success { border-top-color: #27ae60; }
.card.warning { border-top-color: #f39c12; }

/* --- 4. TABLAS PROFESIONALES --- */
table {
    width: 98%;
    border-collapse: collapse;
    margin: 20px auto;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

th, td {
    padding: 15px;
    border-bottom: 1px solid #eee;
    text-align: left;
}

th { 
    background-color: #34495e; 
    color: white; 
    font-weight: 600; 
    text-transform: uppercase;
    font-size: 0.9em;
}

tr:hover { background-color: #f9f9f9; }

code {
    background: #f1f1f1;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    color: #c0392b;
}

/* --- 5. BADGES (ETIQUETAS DE ESTADO Y ROLES) --- */
.badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75em;
    font-weight: bold;
    display: inline-block;
    text-transform: uppercase;
    text-align: center;
    min-width: 80px;
    color: white;
}

.badge.st-abierto { background-color: #e74c3c !important; color: white !important; } 
.badge.st-en-proceso { background-color: #3498db !important; color: white !important; }
.badge.st-cerrado { background-color: #27ae60 !important; color: white !important; }
.badge.st-baja { background-color: #7f8c8d !important; color: white !important; }

body .badge.st-esperando-confirmacion { 
    background-color: #ff9800 !important; 
    color: #1a252f !important; 
    border: 1px solid #e67e22 !important; 
}

.badge.urgent  { background-color: #e74c3c !important; color: white !important; }
.badge.success { background-color: #3498db !important; color: white !important; }
.badge.closed  { background-color: #27ae60 !important; color: white !important; }
.badge.gray    { background-color: #95a5a6 !important; color: white !important; }

.badge-licencia { padding: 5px 10px; border-radius: 4px; font-size: 0.7em; color: white !important; margin-left: 10px; text-transform: uppercase; letter-spacing: 1px;}
.lic-master { background: #2c3e50; border: 1px solid gold; }
.lic-tech { background: #e67e22; }
.lic-viewer { background: #8e44ad; }
.lic-approver { background: #27ae60; }
.lic-employee { background: #3498db; }

/* --- 6. FORMULARIOS Y TARJETAS --- */
.tarjeta-contacto {
    background: white;
    max-width: 800px;
    margin: 30px auto;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.tarjeta-contacto h2 { margin-top: 0; color: #2c3e50; border-bottom: 2px solid #eee; padding-bottom: 10px; }

.tarjeta-contacto input, 
.tarjeta-contacto select, 
.tarjeta-contacto textarea {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: 1px solid #dcdde1;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1em;
}

/* --- 7. BOTONES DE ACCIÓN --- */
.btn-accion {
    padding: 6px 10px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    display: inline-block;
    margin: 2px;
    color: white !important;
    font-weight: bold;
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-accion:hover { transform: translateY(-1px); filter: brightness(1.1); }

.bg-hist  { background-color: #34495e; } 
.bg-edit  { background-color: #3498db; } 
.bg-user  { background-color: #9b59b6; } 
.bg-manto { background-color: #f39c12; } 
.bg-baja  { background-color: #e74c3c; } 
.bg-add   { background-color: #27ae60; } 

/* --- 8. CHAT DINÁMICO --- */
@keyframes gradientProcess {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#chat-box, #quick-chat-body {
    background: linear-gradient(-45deg, #e5ddd5, #d1d8e0, #f7f1e3, #d1ccc0);
    background-size: 400% 400%;
    animation: gradientProcess 15s ease infinite;
    padding: 20px !important;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-radius: 8px;
    border: 1px solid #ddd;
    overflow-y: auto;
    height: 500px;
    max-height: 500px;
}

#chat-box::-webkit-scrollbar, 
#quick-chat-body::-webkit-scrollbar { width: 6px; }
#chat-box::-webkit-scrollbar-thumb, 
#quick-chat-body::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 10px; }

.burbuja {
    padding: 10px 14px;
    max-width: 80%;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
    font-size: 0.9em;
    white-space: pre-wrap; 
    word-break: break-word;
}
.burbuja.usuario { background: #ffffff; align-self: flex-start; border-radius: 0 15px 15px 15px; }
.burbuja.soporte { background: #dcf8c6; align-self: flex-end; border-radius: 15px 0 15px 15px; }

.chat-info { font-size: 0.7em; color: #27ae60; display: block; font-weight: bold; margin-bottom: 3px; }
.chat-fecha { font-size: 0.6em; color: #999; display: block; text-align: right; margin-top: 4px; }
.img-chat { max-width: 100%; border-radius: 10px; cursor: pointer; margin-top: 5px; border: 1px solid #ddd; }

.chat-input-bar { 
    display: flex; gap: 10px; align-items: center; background: white; padding: 10px; 
    border-radius: 30px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); margin-top: 15px; 
}

/* --- 9. BURBUJA FLOTANTE Y MODO MESSENGER --- */
.chat-bubble-launcher {
    position: fixed; bottom: 30px; right: 30px; width: 65px; height: 65px;
    background: linear-gradient(135deg, #007bff, #0056b3); 
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: white; font-size: 30px; cursor: pointer; box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    z-index: 10000; transition: transform 0.3s, background 0.3s;
}
.chat-bubble-launcher:hover { transform: scale(1.1); filter: brightness(1.1); }

#quick-chat {
    position: fixed; bottom: 110px; right: 30px; width: 360px; height: 580px;
    background: white; border-radius: 15px; box-shadow: 0 15px 50px rgba(0,0,0,0.4);
    display: none; flex-direction: column; z-index: 9999; overflow: hidden;
    border: 1px solid #dee2e6;
}

#quick-chat-header { background: #2c3e50; color: white; padding: 15px; display: flex; justify-content: space-between; align-items: center; font-weight: bold; }

#quick-chat-list { overflow-y: auto; flex: 1; background: #fff; }

.noti-item.resolver { 
    background: #fff; border-left: 5px solid #3498db; cursor: pointer; 
    padding: 15px; border-bottom: 1px solid #eee; display: block; width: 100%; box-sizing: border-box;
}
.noti-item.resolver:hover { background: #f7f9fb; }
.noti-item.msj-nuevo { border-left: 5px solid #e74c3c !important; background-color: #fff9f9 !important; }

.punto-rojo-conteo {
    background-color: #e74c3c;
    color: white;
    font-size: 0.7em;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.4);
}

.noti-msj { font-size: 0.8em; color: #7f8c8d; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- 10. NOTIFICACIONES CAMPANA --- */
.noti-container { position: relative; cursor: pointer; }
.noti-count {
    position: absolute; 
    top: -5px; 
    right: -5px; 
    background: #e74c3c; 
    color: white; 
    font-size: 0.7em; 
    padding: 2px 6px; 
    border-radius: 50%; 
    font-weight: bold;
    transition: all 0.3s ease;
}
.noti-dropdown {
    position: absolute; top: 55px !important; right: 10px !important; width: 320px; background: white; border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2); display: none; z-index: 1100; border: 1px solid #ddd;
    max-height: 400px; overflow-y: auto;
}

/* --- 11. MODALES Y OTROS --- */
#modal-zoom {
    display: none; position: fixed; z-index: 10001; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.95); align-items: center; justify-content: center; cursor: zoom-out;
}
#modal-zoom img { max-width: 95%; max-height: 95%; border: 2px solid white; box-shadow: 0 0 20px rgba(255,255,255,0.2); }

/* ESTILOS DE PAGINACIÓN GENERAL (Inventario) */
.paginacion { display: flex; justify-content: center; gap: 8px; margin: 20px 0; }
.paginacion a { padding: 8px 14px; border: 1px solid #dcdde1; text-decoration: none; color: #2c3e50; border-radius: 4px; background: white; font-weight: bold; }
.paginacion .activo { background: #2c3e50 !important; color: white !important; border-color: #2c3e50; }

/* AJUSTE PARA PAGINACIÓN BOOTSTRAP (Usuarios y otros módulos) */
.pagination .page-link {
    padding: 8px 16px;
    color: #2c3e50 !important;
    background-color: #ffffff !important;
    border: 1px solid #dee2e6 !important; 
    transition: all 0.2s;
    box-shadow: none !important;
}

.pagination .page-item.active .page-link {
    background-color: #2c3e50 !important; 
    border-color: #2c3e50 !important;
    color: white !important;
}

.pagination .page-link:hover {
    background-color: #f8f9fa !important;
    color: #0056b3 !important;
}

/* --- SIDEBAR CONFIG (AJUSTADO PARA ALTURA FIJA) --- */
.wrapper { display: flex; align-items: stretch; }

#sidebar {
    min-width: 250px; 
    max-width: 250px; 
    height: 100vh; /* Ocupa el 100% de la ventana */
    background: #2c3e50; 
    color: #fff; 
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: sticky; 
    top: 0; 
    z-index: 1000;
    display: flex;
    flex-direction: column; /* Permite posicionar el footer al fondo */
}

#sidebar:not(.pinned) { min-width: 80px; max-width: 80px; }
#sidebar:not(.pinned) span, #sidebar:not(.pinned) h4 { display: none; }
#sidebar:not(.pinned):hover { min-width: 250px; max-width: 250px; }
#sidebar:not(.pinned):hover span, #sidebar:not(.pinned):hover h4 { display: inline; }

#sidebar .sidebar-header { padding: 20px; background: #1a252f; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }

#sidebar ul.components {
    padding: 20px 0;
    flex-grow: 1; /* Hace que la lista ocupe el espacio disponible */
    overflow-y: auto; /* Scroll interno si el menú es muy largo */
}

#sidebar ul li a { padding: 15px 25px; font-size: 1.1em; display: block; color: #bdc3c7; text-decoration: none; }
#sidebar ul li a i { margin-right: 15px; font-size: 1.2em; }
#sidebar ul li a:hover { color: #fff; background: #34495e; }
#sidebar.pinned { min-width: 250px; }

/* FOOTER DEL SIDEBAR (SIEMPRE AL FONDO) */
.sidebar-footer { 
    margin-top: auto; /* Empuja el footer al final del flex container */
    padding: 20px; 
    background: #1a252f;
    flex-shrink: 0;
}

.btn-accion { text-transform: none; letter-spacing: normal; }
.badge.text-dark.border {
    font-weight: 500; font-size: 0.85em; color: #212529 !important;
    background-color: #a77979 !important;
}

/* --- 12. FOOTER DEL CONTENIDO --- */
footer.footer {
    border-top: 1px solid #e9ecef;
    margin-top: 2rem !important;
    padding-top: 1rem;
}

.nav-footer .nav-link {
    font-size: 0.85rem;
    color: #8898aa !important;
}

.copyright {
    font-size: 0.875rem;
    color: #8898aa;
}