/* General - Paleta Dark */
* { box-sizing: border-box; }

body { 
    margin: 0; 
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 
    background: #020617; /* Fondo ultra oscuro */
    color: #f8fafc;      /* Texto claro principal */
}

.hidden { display: none !important; }

/* Login */
.overlay { 
    position: fixed; inset: 0; background: #020617; 
    display: flex; align-items: center; justify-content: center; z-index: 100;
}

.login-card { 
    background: #0f172a; 
    padding: 2.5rem; 
    border-radius: 1rem; 
    width: 100%; 
    max-width: 400px; 
    text-align: center;
    border: 1px solid #1e293b;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.icon-circle { 
    font-size: 2.5rem; background: #6366f1; color: white; 
    width: 70px; height: 70px; border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; margin: 0 auto 1.5rem;
}

.form-group { text-align: left; margin-bottom: 1.2rem; }
.form-group label { display: block; font-size: 0.85rem; margin-bottom: 0.5rem; color: #94a3b8; font-weight: 600; }

.form-group input { 
    width: 100%; 
    padding: 0.75rem; 
    background: #1e293b; 
    border: 1px solid #334155; 
    border-radius: 0.5rem; 
    color: white;
    outline: none;
    transition: border 0.3s ease;
}

.form-group input:focus { border-color: #6366f1; }

.btn-primary { 
    width: 100%; background: #6366f1; color: white; border: none; 
    padding: 0.8rem; border-radius: 0.5rem; cursor: pointer; font-weight: bold;
    transition: background 0.3s ease;
}

.btn-primary:hover { background: #4f46e5; }

/* App Layout */
.app-container { display: flex; height: 100vh; }

.sidebar { 
    width: 260px; 
    background: #0f172a; 
    border-right: 1px solid #1e293b; 
    display: flex; flex-direction: column; padding: 1.5rem;
}

.sidebar-header { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 2.5rem; }
.logo-icon { font-size: 1.5rem; color: #6366f1; }
.logo-text { font-weight: bold; font-size: 1.2rem; color: #f8fafc; }

.menu { flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }

.menu-item { 
    text-align: left; background: none; border: none; padding: 0.8rem 1rem; 
    border-radius: 0.5rem; cursor: pointer; 
    color: #94a3b8; 
    font-weight: 500;
    transition: all 0.2s ease;
}

.menu-item:hover { background: #1e293b; color: #f8fafc; }
.menu-item.active { background: #1e293b; color: #6366f1; border-left: 3px solid #6366f1; border-radius: 0 0.5rem 0.5rem 0; }

.sidebar-footer { border-top: 1px solid #1e293b; padding-top: 1rem; }

.btn-logout { 
    width: 100%; color: #f87171; background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.2); 
    padding: 0.6rem; border-radius: 0.4rem; cursor: pointer; font-weight: bold;
}

/* Content Area */
.content { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: #020617; }

.content-header { 
    padding: 1rem 2rem; 
    background: #0f172a; 
    border-bottom: 1px solid #1e293b; 
    display: flex; justify-content: space-between; align-items: center;
}

.scroll-area { flex: 1; padding: 2rem; overflow-y: auto; }

/* Dashboard Cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }

.card { 
    background: #0f172a; 
    padding: 1.5rem; 
    border-radius: 1rem; 
    border: 1px solid #1e293b; 
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.card h3 { color: #94a3b8; font-size: 0.9rem; margin: 0; }
.stat-value { font-size: 2.2rem; font-weight: 800; margin: 0.5rem 0; color: #f8fafc; }

.progress-bg { background: #1e293b; height: 10px; border-radius: 5px; overflow: hidden; margin-top: 1rem; }
.progress-fill { height: 100%; background: #6366f1; transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); }

/* Terminal */
.terminal {max-height: 600px; background: #0f172a; color: #34d399; border: 1px solid #0560df; border-radius: 0.8rem; height: 100%; display: flex; flex-direction: column; font-family: monospace; }
.terminal-header { background: #1e293b; border-radius: 0.8rem 0.8rem 0 0; padding: 0.5rem 1rem; font-size: 0.8rem; border-bottom: 1px solid #334155; }
.terminal-body { flex: 1; padding: 1rem; overflow-y: auto; font-size: 0.9rem; }
.terminal-input-row { display: flex; gap: 0.5rem; border-radius:0 0 0.8rem 0.8rem ; padding: 1rem; background: #020617; }
.terminal-input-row input { background: transparent; border: none; color: white; flex: 1; outline: none; font-family: monospace; }
.prompt { font-weight: bold; color: #4f46e5; }

.cuadroTexto{
    margin: 10px;
    color: #94a3b8;
    font-size: 15px;
}

/*scroll bar*/
#terminal-output{
    flex: 1; 
    overflow-y: auto; 
    display: flex;
    flex-direction: column;
    padding: 10px;
    min-height: 0;
}

#terminal-output::-webkit-scrollbar {
    width: 8px;               
    height: 8px;              
}

#terminal-output::-webkit-scrollbar-thumb {
    background: #334155;      
    border-radius: 10px;
    border: 2px solid #0f172a; 
}

/* cambia color scroll bar con raton por encima */
#terminal-output::-webkit-scrollbar-thumb:hover {
    background: #4f46e5;      
}

/* Audit Table Dark */
.audit-table, .audit-metrics-table, .audit-errores-table, .audit-shell-table  { width: 100%; border-collapse: collapse; font-size: 0.9rem; }

.audit-table th, .audit-metrics-table th, .audit-errores-table th, .audit-shell-table th { 
    text-align: left; padding: 1rem; 
    border-bottom: 2px solid #1e293b; 
    color: #64748b; 
    background: rgba(15, 23, 42, 0.5);
}

.audit-table td, .audit-metrics-table td, .audit-errores-table td, .audit-shell-table td { padding: 1rem; border-bottom: 1px solid #1e293b; color: #cbd5e1; }

.badge { padding: 0.3rem 0.7rem; border-radius: 2rem; font-weight: bold; font-size: 0.75rem; }
.badge-ok { background: rgba(34, 197, 94, 0.1); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.2); }
.badge-alert { background: rgba(239, 68, 68, 0.1); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.2); }

/* Toasts Apilados */
#toast-container {
    position: fixed; bottom: 20px; right: 20px;
    display: flex; flex-direction: column-reverse; gap: 10px; z-index: 10000;
}

.toast {
    min-width: 300px; padding: 1rem 1.5rem; border-radius: 0.75rem; 
    color: white; font-weight: 600; font-size: 0.9rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.info { background: #1e293b; border-left: 4px solid #6366f1; }
.toast.warning { background: #78350f; border-left: 4px solid #f59e0b; color: #fef3c7; }
.toast.danger { background: #7f1d1d; border-left: 4px solid #ef4444; color: #fee2e2; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* media queri*/
@media (max-width: 900px) {

    .app-container {
        flex-direction: column !important;
        height: 100vh;
        overflow: hidden;
    }
    .sidebar {
        width: 100% !important;
        height: auto;
        min-height: auto;

        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        
        padding: 0.5rem 1rem;
        border-right: none;
        border-bottom: 1px solid #1e293b;
        flex-shrink: 0;
        gap: 10px; 
        align-items: center;
    }

    /* logo*/
    .sidebar-header {
        grid-column: 1;
        grid-row: 1;
        margin: 0;
        display: flex;
        align-items: center;
    }
    .logo-text { display: none; }
    .logo-icon { font-size: 1.4rem; }

    /* cerrar sesion*/
    .sidebar-footer {
        grid-column: 2;
        grid-row: 1;
        border: none;
        padding: 0;
        margin: 0;
    }
    .btn-logout {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }

    /* menu navegacion */
    .menu {
        grid-column: 1 / -1; 
        grid-row: 2;
        
        width: 100%;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 5px;
        overflow-x: auto; /* scrol horizontal */
        padding-bottom: 5px;
    }

    .menu-item {
        flex: 1; 
        padding: 0.6rem;
        font-size: 0.9rem;
        white-space: nowrap;
        text-align: center;
        border-left: none !important;
        background: rgba(30, 41, 59, 0.5);
        border-radius: 0.5rem;
        min-width: 100px; 
    }
    
    .menu-item.active {
        background: #1e293b;
        color: #6366f1;
        border-bottom: 2px solid #6366f1;
        border-radius: 0.5rem;
    }

    .content {
        width: 100%;
        height: 100%; 
        overflow: hidden;
    }
    .content-header { padding: 0.8rem 1rem; }
    .scroll-area { padding: 1rem; }
    .stats-grid { grid-template-columns: 1fr; }

    /* scrol lateral */
    .card { padding: 1rem; overflow-x: auto; }
    .audit-table, .audit-metrics-table, .audit-errores-table, .audit-shell-table { min-width: 600px; }
    .audit-table td, .audit-metrics-table td, .audit-errores-table td, .audit-shell-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }
}