/* Reset y variables CSS */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #059669;
    --danger-color: #dc2626;
    --warning-color: #d97706;
    --info-color: #0891b2;
    
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-dark: #1e293b;
    --bg-sidebar: #334155;
    --bg-sidebar-hover: #475569;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #f1f5f9;
    --text-muted: #94a3b8;
    
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 60px;
    --header-height: 70px;
    --footer-height: 50px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    font-size: 14px;
}

/* Estilos para páginas de login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-primary);
    padding: 20px;
}

.login-form {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 28px;
    font-weight: 600;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 16px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: var(--transition-fast);
    background-color: var(--bg-secondary);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition-fast);
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-danger {
    background-color: #fef2f2;
    color: var(--danger-color);
    border: 1px solid #fecaca;
}

.alert-success {
    background-color: #f0fdf4;
    color: var(--success-color);
    border: 1px solid #bbf7d0;
}

/* Overlay de spinner para botón de login */
.btn-loading {
    position: relative;
}

.btn-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
    z-index: 1;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.btn-loading .btn-loading-overlay {
    opacity: 1;
    visibility: visible;
}

.btn-loading:disabled {
    opacity: 1;
    cursor: not-allowed;
}

.btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

/* Animación del spinner */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Layout principal con sidebar */
.main-layout {
    display: grid;
    grid-template-areas: 
        "sidebar header"
        "sidebar content"
        "sidebar footer";
    grid-template-columns: var(--sidebar-collapsed-width) 1fr;
    grid-template-rows: var(--header-height) minmax(0, 1fr) var(--footer-height);
    min-height: 100vh;
    transition: grid-template-columns var(--transition-normal);
    gap: 0;
}

/* Cuando el sidebar está expandido (hover) */
.main-layout:has(.sidebar:hover) {
    grid-template-columns: var(--sidebar-width) 1fr;
}

/* Header */
.header {
    grid-area: header;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    z-index: 50;
    overflow: visible;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    min-height: var(--header-height);
    padding: 0 20px;
}

.sidebar-toggle {
    display: none; /* Solo visible en móvil */
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: var(--transition-fast);
}

.sidebar-toggle:hover {
    background-color: var(--bg-primary);
}

.header-title h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-name {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-weight: 500;
}

.logout-btn {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background-color: var(--danger-color);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    transition: var(--transition-fast);
    font-size: 14px;
}

.logout-btn:hover {
    background-color: #b91c1c;
    transform: translateY(-1px);
}

/* Sidebar */
.sidebar {
    grid-area: sidebar;
    background: var(--bg-sidebar);
    width: 100%;
    transition: var(--transition-normal);
    position: relative;
    z-index: 100;
    overflow: hidden;
}

/* Mostrar texto solo cuando el sidebar se expande */
.sidebar .nav-text,
.sidebar .sidebar-title {
    opacity: 0;
    white-space: nowrap;
    transition: opacity 0.2s ease;
}

.sidebar:hover .nav-text,
.sidebar:hover .sidebar-title {
    opacity: 1;
}

.sidebar-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    width: var(--sidebar-width);
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--bg-sidebar-hover);
    margin-bottom: 20px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-light);
}

.sidebar-logo i {
    font-size: 24px;
    min-width: 24px;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    padding: 0 10px;
}

.nav-list {
    list-style: none;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-light);
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.nav-link:hover {
    background-color: var(--bg-sidebar-hover);
    transform: translateX(4px);
}

.nav-link.active {
    background-color: var(--primary-color);
    color: white;
}

.nav-link i {
    font-size: 16px;
    min-width: 16px;
    text-align: center;
}

.nav-text {
    font-weight: 500;
}

.sidebar-footer {
    padding: 20px 10px 0;
    border-top: 1px solid var(--bg-sidebar-hover);
    margin-top: auto;
}

.logout-link {
    color: #f87171 !important;
}

.logout-link:hover {
    background-color: rgba(248, 113, 113, 0.1) !important;
    color: #ef4444 !important;
}

/* Contenido principal */
.content {
    grid-area: content;
    padding: 15px 30px 30px;
    background-color: var(--bg-primary);
    overflow-y: auto;
}

.content-header {
    margin-bottom: 10px;
}

.content-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.content-subtitle {
    color: var(--text-secondary);
    font-size: 16px;
}

.card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.card-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.card-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Footer */
.footer {
    grid-area: footer;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0 30px;
    font-size: 12px;
    color: var(--text-secondary);
}

.footer-info {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Overlay para móvil */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* Animaciones */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card, .alert {
    animation: slideIn 0.3s ease-out;
}

/* Estados de carga */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Estilos para tablas de datos */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table th {
    background-color: var(--bg-primary);
    font-weight: 600;
    color: var(--text-primary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table tr:hover {
    background-color: var(--bg-primary);
}

.data-table td:last-child,
.data-table th:last-child {
    text-align: center;
}

/* Centrar perfectamente la columna de acciones en tablas */
.data-table th.acciones,
.data-table td.acciones {
    text-align: center;
    padding-left: 0;
    padding-right: 0;
}
.data-table th.acciones > div,
.data-table td.acciones > div {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
}

/* Mejorar responsividad de th igual que td en tablas */
@media (max-width: 768px) {
    .data-table th,
    .data-table td {
        padding: 8px 4px;
        font-size: 12px;
        word-break: break-word;
        white-space: normal;
    }
    .data-table th {
        font-weight: 500;
    }
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background-color: rgb(37 99 235 / 0.1);
    color: var(--primary-color);
}

.badge-success {
    background-color: rgb(5 150 105 / 0.1);
    color: var(--success-color);
}

.badge-warning {
    background-color: rgb(217 119 6 / 0.1);
    color: var(--warning-color);
}

.badge-danger {
    background-color: rgb(220 38 38 / 0.1);
    color: var(--danger-color);
}

.badge-info {
    background-color: rgb(8 145 178 / 0.1);
    color: var(--info-color);
}

.badge-secondary {
    background-color: rgb(100 116 139 / 0.1);
    color: var(--secondary-color);
}

/* Botones de iconos */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 14px;
}

.btn-icon:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

.btn-icon.btn-danger {
    background-color: rgb(220 38 38 / 0.1);
    color: var(--danger-color);
}

.btn-icon.btn-danger:hover {
    background-color: var(--danger-color);
    color: white;
}

/* Modales */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal[style*="display: flex"] .modal-overlay {
    opacity: 1;
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    opacity: 0;
    transform: scale(0.95) translateY(-20px);
    transition: all 0.2s ease;
}

.modal[style*="display: flex"] .modal-content {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    border-radius: 0 0 12px 12px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Checkbox group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.checkbox-item:hover {
    background-color: var(--bg-primary);
}

.checkbox-item input[type="checkbox"] {
    margin: 0;
    accent-color: var(--primary-color);
}

/* Responsivo para modales */
@media (max-width: 768px) {
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        max-width: 100%;
        max-height: 95vh;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 4px;
    }
}

/* Botones de acción uniformes para todas las tablas */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 14px;
    text-decoration: none;
}

.btn-action:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

.btn-action.btn-danger {
    background-color: rgb(220 38 38 / 0.1);
    color: var(--danger-color);
}

.btn-action.btn-danger:hover {
    background-color: var(--danger-color);
    color: white;
}

.btn-action.btn-warning {
    background-color: rgb(217 119 6 / 0.1);
    color: var(--warning-color);
}

.btn-action.btn-warning:hover {
    background-color: var(--warning-color);
    color: white;
}

.btn-action.btn-success {
    background-color: rgb(5 150 105 / 0.1);
    color: var(--success-color);
}

.btn-action.btn-success:hover {
    background-color: var(--success-color);
    color: white;
}

/* Contenedor de botones de acción en tablas */
.table-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

/* Estilos para la visualización de notas en tablas */
.notes-preview {
    display: block;
    line-height: 1.4;
    color: var(--text-primary);
    word-wrap: break-word;
    white-space: normal;
}

.notes-preview:hover {
    color: var(--primary-color);
    cursor: help;
}

/* Estilos para separadores HR en sidebar - Aplicado globalmente */
.sidebar hr,
aside.sidebar hr,
.sidebar .nav-list hr {
    border: none !important;
    height: 1px !important;
    background-color: #64748b !important;
    margin: 12px 16px !important;
    opacity: 0.6 !important;
    display: block !important;
}

/* ============================================================================
   SECURITY DASHBOARD STYLES
   ============================================================================ */

/* Security Loading */
.security-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    flex-direction: column;
    gap: 20px;
}

/* ==============================================
   SISTEMA DE LOADING UNIVERSAL PARA TABLAS
   ============================================== */

/* Overlay para tablas con loading */
.table-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(2px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    border-radius: 8px;
    transition: opacity 0.3s ease;
}

/* Contenedor de tabla con loading */
.table-container {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

/* Spinner moderno y elegante */
.modern-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 40px 20px;
}

.spinner-circle {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: modernSpin 1s linear infinite;
}

.spinner-dots {
    display: flex;
    gap: 6px;
}

.spinner-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: dotPulse 1.4s ease-in-out infinite both;
}

.spinner-dot:nth-child(1) { animation-delay: -0.32s; }
.spinner-dot:nth-child(2) { animation-delay: -0.16s; }
.spinner-dot:nth-child(3) { animation-delay: 0s; }

.spinner-text {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    text-align: center;
    margin-top: 8px;
}

/* Animaciones */
@keyframes modernSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes dotPulse {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.3;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Versión simple del spinner para uso en celdas */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-secondary);
    padding: 30px 20px;
}

.loading-spinner .spinner-circle {
    width: 24px;
    height: 24px;
    border-width: 2px;
}

.loading-spinner .spinner-text {
    font-size: 14px;
    margin-top: 0;
}

/* Estados para tablas */
.table-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    text-align: center;
}

.table-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.table-state-message {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
}

.table-state-description {
    font-size: 14px;
    opacity: 0.8;
}

/* Mejoras específicas para diferentes tipos de loading */
.loading-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.loading-inline .spinner-circle {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

/* Responsive */
@media (max-width: 768px) {
    .modern-spinner {
        padding: 30px 15px;
        gap: 12px;
    }
    
    .spinner-circle {
        width: 32px;
        height: 32px;
    }
    
    .table-state {
        padding: 40px 15px;
    }
    
    .table-state-icon {
        font-size: 36px;
    }
}

/* Security Dashboard Layout */
.security-dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
}

.security-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.security-content-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
    align-items: start;
}

@media (max-width: 1200px) {
    .security-content-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

/* Security Metric Cards */
.security-metric-card {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.security-metric-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.metric-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.metric-header i {
    font-size: 20px;
    color: var(--text-secondary);
    opacity: 0.7;
}

.metric-value {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.metric-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.metric-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-left: 12px;
}

.metric-indicator.high {
    background-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.metric-indicator.medium {
    background-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.metric-indicator.low {
    background-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.metric-trend, .metric-status, .metric-period {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.metric-change {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Security Sections */
.security-section {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.section-title i {
    color: var(--primary-color);
}

/* Security Configuration */
.security-config-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.config-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--background-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.config-status {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.config-status.ok {
    background-color: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.config-status.warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.config-status.error {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.config-details h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.config-details p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 4px 0;
}

.config-details small {
    font-size: 12px;
    color: var(--text-muted);
}

.config-loading, .alert-loading, .ip-loading, .session-loading, .stats-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    color: var(--text-secondary);
    justify-content: center;
}

/* Security Alerts */
.security-alerts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--background-color);
}

.alert-item.high {
    border-left: 4px solid #ef4444;
    background: rgba(239, 68, 68, 0.02);
}

.alert-item.medium {
    border-left: 4px solid #f59e0b;
    background: rgba(245, 158, 11, 0.02);
}

.alert-item.low {
    border-left: 4px solid #10b981;
    background: rgba(16, 185, 129, 0.02);
}

.alert-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.alert-content h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    text-transform: capitalize;
}

.alert-content p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 4px 0;
    line-height: 1.4;
}

.alert-content small {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.no-alerts, .no-suspicious-ips {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.no-alerts i, .no-suspicious-ips i {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* Suspicious IPs */
.suspicious-ips-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ip-item {
    padding: 16px;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.ip-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.ip-info strong {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 14px;
    color: var(--text-primary);
}

.ip-attempts {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.ip-details p {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 4px 0;
    line-height: 1.3;
}

/* Session Information */
.session-info-panel {
    min-height: 200px;
}

.session-details {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.session-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--background-color);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.session-item label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.session-item span {
    font-size: 13px;
    color: var(--text-primary);
    font-family: 'Monaco', 'Menlo', monospace;
}

.session-item span.expiring {
    color: #ef4444;
    font-weight: 600;
}

.session-progress {
    margin-top: 16px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e 0%, #f59e0b 70%, #ef4444 100%);
    transition: width 0.3s ease;
}

.session-progress small {
    font-size: 11px;
    color: var(--text-muted);
}

/* Login Statistics */
.login-stats-panel {
    min-height: 200px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.stat-item {
    text-align: center;
    padding: 16px;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.stat-number {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.reasons-list {
    margin-top: 16px;
}

.reasons-list h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}

.reason-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 13px;
}

.reason-count {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
    font-size: 11px;
}

/* Security Actions */
.security-actions-panel {
    padding: 20px 0;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.action-btn.primary {
    background-color: var(--primary-color);
    color: white;
}

.action-btn.primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.action-btn.secondary {
    background-color: var(--secondary-color);
    color: white;
}

.action-btn.secondary:hover {
    background-color: #7c3aed;
    transform: translateY(-1px);
}

.action-btn.success {
    background-color: #22c55e;
    color: white;
}

.action-btn.success:hover {
    background-color: #16a34a;
    transform: translateY(-1px);
}

/* Error States */
.security-error, .session-error, .stats-error {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.security-error i, .session-error i, .stats-error i {
    font-size: 48px;
    color: #ef4444;
    margin-bottom: 16px;
}

.security-error h3 {
    font-size: 20px;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}

.security-error p, .session-error p, .stats-error p {
    font-size: 14px;
    margin: 0 0 20px 0;
    line-height: 1.5;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 9999;
    max-width: 350px;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    border-left: 4px solid #22c55e;
}

.notification.error {
    border-left: 4px solid #ef4444;
}

.notification.info {
    border-left: 4px solid var(--primary-color);
}

.notification i {
    font-size: 16px;
}

.notification.success i {
    color: #22c55e;
}

.notification.error i {
    color: #ef4444;
}

.notification.info i {
    color: var(--primary-color);
}

.notification span {
    font-size: 14px;
    color: var(--text-primary);
    flex: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .security-metrics-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .security-metric-card {
        padding: 16px;
    }
    
    .metric-number {
        font-size: 24px;
    }
    
    .security-section {
        padding: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .session-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .ip-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100px);
    }
    
    .notification.show {
        transform: translateY(0);
    }
}

/* Dark mode adjustments for security dashboard */
@media (prefers-color-scheme: dark) {
    .security-metric-card,
    .security-section {
        background: #1f2937;
        border-color: #374151;
    }
    
    .config-item,
    .alert-item,
    .ip-item,
    .session-item,
    .stat-item,
    .reason-item {
        background: #111827;
        border-color: #374151;
    }
    
    .notification {
        background: #1f2937;
        border-color: #374151;
    }
}

/* Estilos para badges de roles */
.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-badge.role-admin {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.role-badge.role-user {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
    border: 1px solid rgba(59, 130, 246, 0.2);
}



