/* Variables CSS - Paleta Moderna */
:root {
    --primary-color: #1f2937;
    --secondary-color: #374151;
    --accent-color: #6b7280;
    --text-color: #111827;
    --text-muted: #9ca3af;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.1);
    --sidebar-width: 280px;
    --sidebar-collapsed: 70px;
    --hover-bg: rgba(107, 114, 128, 0.1);
    --active-bg: #374151;
}

/* Reset y base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-color);
    line-height: 1.6;
}

/* Login Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    padding: 20px;
}

.login-card {
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    border-radius: 50%;
    object-fit: contain;
}

.login-header h2 {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 5px;
}

.login-form .form-control {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.login-form .form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.2rem rgba(107, 114, 128, 0.25);
}

.btn-dark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    border-radius: 8px;
    padding: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-dark:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    transform: translateY(-1px);
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    transition: all 0.3s ease;
}

.sidebar.collapsed .sidebar-header {
    padding: 15px;
    display: flex;
    justify-content: center;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
}

.sidebar.collapsed .logo-container {
    gap: 0;
    justify-content: center;
}

.logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    transition: all 0.3s ease;
}

.sidebar.collapsed .logo {
    width: 35px;
    height: 35px;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .nav-text {
    opacity: 0;
    pointer-events: none;
}

.sidebar-menu {
    flex: 1;
    padding: 20px 0;
}

.sidebar-menu .nav-link {
    color: rgba(255,255,255,0.9);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
    margin: 2px 12px;
    font-weight: 500;
    position: relative;
}

.sidebar.collapsed .sidebar-menu .nav-item {
    width: 100%;
    margin-bottom: 5px;
}

.sidebar.collapsed .sidebar-menu .nav-link {
    padding: 15px;
    justify-content: center;
    margin: 0;
}

.sidebar.collapsed .sidebar-menu .nav-link .material-icons,
.sidebar.collapsed .sidebar-menu .nav-link .fab {
    margin-right: 0;
    width: auto;
    font-size: 20px;
}

.sidebar-menu .nav-link:hover {
    background-color: var(--hover-bg);
    color: white;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.sidebar.collapsed .sidebar-menu .nav-link:hover {
    transform: none;
}

.sidebar-menu .nav-link.active {
    background-color: var(--active-bg);
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.sidebar-menu .nav-link.active {
    background: linear-gradient(90deg, var(--accent-color) 0%, var(--accent-color) 4px, var(--active-bg) 4px, var(--active-bg) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.sidebar.collapsed .sidebar-menu .nav-link.active {
    background: linear-gradient(90deg, var(--accent-color) 0%, var(--accent-color) 3px, var(--active-bg) 3px, var(--active-bg) 100%);
    margin: 2px 8px;
    padding: 14px;
    justify-content: center;
    min-width: 54px;
    max-width: 54px;
    overflow: hidden;
}

.sidebar-menu .nav-link i {
    font-size: 20px;
    width: 24px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar.collapsed .sidebar-menu .nav-link i {
    width: 100%;
    margin: 0;
}

.sidebar-menu .nav-link .material-icons {
    font-size: 20px;
}

.sidebar-menu .nav-link .fab {
    font-size: 16px;
    width: 24px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar.collapsed .sidebar-menu .nav-link .fab {
    width: 100%;
    margin: 0;
}

/* Dropdown styles */
.sidebar-menu .dropdown-toggle::after {
    display: none;
}

.sidebar-menu .sub-link {
    padding: 10px 20px 10px 50px;
    font-size: 14px;
    color: rgba(255,255,255,0.8);
    border-radius: 6px;
    margin: 1px 12px 1px 24px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.sidebar-menu .sub-link:hover {
    background-color: rgba(255,255,255,0.1);
    color: white;
    transform: translateX(2px);
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.sidebar-menu .sub-link.active {
    background-color: rgba(96, 165, 250, 0.3);
    color: white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.sidebar-menu .sub-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    background-color: #60a5fa;
    border-radius: 2px;
}

.sidebar-menu .sub-link i {
    font-size: 16px;
    width: 20px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.footer-section {
    margin-bottom: 15px;
}

.footer-link {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 14px;
    transition: all 0.3s ease;
}

.footer-link:hover {
    color: white;
    background-color: rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 8px 12px;
}

.footer-submenu {
    list-style: none;
    padding: 0;
    margin: 8px 0 0 0;
}

.footer-sub-link {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.footer-sub-link:hover {
    color: white;
    background-color: rgba(255,255,255,0.1);
}

.footer-sub-link.active {
    background-color: rgba(107, 114, 128, 0.3);
    color: white;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,0.8);
    margin-bottom: 12px;
    font-size: 14px;
}

.sidebar.collapsed .user-info {
    justify-content: center;
    gap: 0;
}

.sidebar.collapsed .footer-link {
    justify-content: center;
    padding: 8px;
}

.sidebar.collapsed .footer-submenu {
    display: none;
}

.user-info i {
    font-size: 20px;
}

.logout-btn {
    width: 100%;
    border-color: rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 14px;
}

.sidebar.collapsed .logout-btn {
    padding: 8px;
    gap: 0;
}

.logout-btn:hover {
    background-color: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.5);
    color: white;
}

/* Logo as Toggle */
.logo-container {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 8px;
    border-radius: 8px;
}

.logo-container:hover {
    background-color: rgba(255,255,255,0.1);
    transform: scale(1.05);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 80px 30px 30px;
    transition: all 0.3s ease;
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed);
    width: calc(100% - var(--sidebar-collapsed));
}

/* Messages */
.messages-container {
    margin-bottom: 20px;
}

/* Content Cards */
.content-card {
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 30px;
    margin-bottom: 20px;
}

.content-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.content-header h1 {
    color: var(--primary-color);
    font-size: 28px;
    font-weight: 600;
    margin: 0;
}

.content-header p {
    color: var(--text-muted);
    margin: 5px 0 0 0;
}

/* Tables */
.table {
    margin: 0;
}

.table th {
    background-color: var(--bg-light);
    color: var(--primary-color);
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    padding: 15px;
}

.table td {
    padding: 15px;
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: var(--bg-light);
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 10px 20px;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

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

.btn-primary:hover {
    background-color: #2980b9;
    border-color: #2980b9;
}

/* Forms */
.form-control {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.2rem rgba(107, 114, 128, 0.25);
}

.form-label {
    color: var(--primary-color);
    font-weight: 500;
    margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 80px 15px 15px;
    }
    
    .sidebar-toggle {
        left: 15px;
    }
    
    .login-card {
        padding: 30px 20px;
    }
}

.panel-comunicacion-continua .page-title {
    color: var(--primary-color);
    font-weight: 600;
}

.acciones-comunicacion {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.boton-resumen-ejecutivo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.estado-en-desarrollo {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 999px;
}

.actualizacion-panel {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.actualizacion-titulo {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color);
}

.actualizacion-fecha {
    font-size: 12px;
    color: var(--text-muted);
}

.kpi-continuo {
    border-left: 4px solid var(--accent-color);
}

.kpi-variacion {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
}

.variacion-positiva {
    color: #166534;
    background: rgba(22, 163, 74, 0.12);
}

.variacion-negativa {
    color: #991b1b;
    background: rgba(220, 38, 38, 0.12);
}

.variacion-neutral {
    color: #374151;
    background: rgba(107, 114, 128, 0.12);
}

.indice-general {
    display: flex;
    align-items: center;
    gap: 12px;
}

.indice-valor {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary-color);
}

.indice-estado {
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 999px;
}

.indice-variacion {
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
}

.estado-solido {
    color: #166534;
    background: rgba(22, 163, 74, 0.16);
}

.estado-observacion {
    color: #92400e;
    background: rgba(245, 158, 11, 0.2);
}

.estado-critico {
    color: #991b1b;
    background: rgba(220, 38, 38, 0.18);
}

.indice-barra {
    height: 8px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.indice-barra .progress-bar {
    border-radius: 999px;
}

.subindices {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.subindice-nombre {
    font-weight: 600;
    color: var(--primary-color);
}

.subindice-valor {
    font-weight: 600;
    color: var(--secondary-color);
}

.subindice-detalle {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.subindice-barra {
    height: 6px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.subindice-barra .progress-bar {
    background: #374151;
    border-radius: 999px;
}

.lista-comparativos {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comparativo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-light);
    padding: 10px 12px;
    border-radius: 12px;
}

.comparativo-titulo {
    font-weight: 600;
    display: block;
    color: var(--primary-color);
}

.comparativo-detalle {
    font-size: 12px;
    color: var(--text-muted);
}

.comparativo-variacion {
    font-weight: 600;
    color: var(--primary-color);
}

.alertas-lista {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alerta-item {
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--bg-light);
    border-left: 4px solid #9ca3af;
}

.alerta-item.alerta-alto {
    border-left-color: #dc2626;
    background: rgba(220, 38, 38, 0.08);
}

.alerta-item.alerta-medio {
    border-left-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.alerta-item.alerta-bajo {
    border-left-color: #16a34a;
    background: rgba(22, 163, 74, 0.1);
}

.alerta-titulo {
    margin-bottom: 4px;
    font-weight: 600;
    color: var(--primary-color);
}

.alerta-detalle {
    margin-bottom: 0;
    font-size: 13px;
    color: var(--secondary-color);
}

.grafico-alto {
    height: 260px !important;
}

.grafico-medio {
    height: 240px !important;
}

.panel-fuentes-datos .page-title {
    color: var(--primary-color);
    font-weight: 600;
}

.resumen-fuente {
    border-left: 4px solid var(--accent-color);
}

.fuente-card {
    height: 100%;
}

.fuente-detalles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.fuente-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fuente-label {
    font-size: 12px;
    color: var(--text-muted);
}

.fuente-valor {
    font-weight: 600;
    color: var(--secondary-color);
}

.fuente-calidad {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fuente-registros {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.estado-activa {
    background: rgba(22, 163, 74, 0.15);
    color: #166534;
}

.estado-integracion {
    background: rgba(245, 158, 11, 0.2);
    color: #92400e;
}

.estado-pendiente {
    background: rgba(107, 114, 128, 0.2);
    color: #374151;
}

.calidad-alta {
    background: rgba(22, 163, 74, 0.15);
    color: #166534;
}

.calidad-media {
    background: rgba(245, 158, 11, 0.2);
    color: #92400e;
}

.calidad-baja {
    background: rgba(220, 38, 38, 0.18);
    color: #991b1b;
}

.panel-diccionario-indicadores .page-title {
    color: var(--primary-color);
    font-weight: 600;
}

.boton-agregar-indicador {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 10px;
}

.indicador-card {
    height: 100%;
    border-left: 4px solid var(--accent-color);
}

.indicador-nombre {
    color: var(--primary-color);
    font-weight: 600;
}

.indicador-datos {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.indicador-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.indicador-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.indicador-valor {
    color: var(--secondary-color);
    font-size: 14px;
}

.indicador-frecuencia {
    background: rgba(55, 65, 81, 0.1);
    color: var(--secondary-color);
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    width: fit-content;
}

.panel-feedback-usuarios .page-title {
    color: var(--primary-color);
    font-weight: 600;
}

.formulario-feedback .form-control,
.formulario-feedback .form-select {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 14px;
}

.formulario-feedback .form-label {
    color: var(--primary-color);
    font-weight: 500;
    font-size: 14px;
}

.feedback-lista {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.feedback-item {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 14px 16px;
    border-left: 4px solid var(--accent-color);
}

.feedback-cabecera {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.feedback-usuario {
    font-weight: 600;
    color: var(--primary-color);
}

.feedback-estado {
    background: rgba(107, 114, 128, 0.15);
    color: var(--secondary-color);
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 11px;
}

.feedback-categoria {
    display: inline-block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.feedback-mensaje {
    margin-bottom: 0;
    color: var(--secondary-color);
    font-size: 14px;
}
