/* SoftCoach - Estilos del Dashboard */

/* Variables */
:root {
    --sidebar-width: 280px;
    --navbar-height: 60px;
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
}

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

.sidebar-container {
    width: var(--sidebar-width);
    background-color: #fff;
    border-right: 1px solid #dee2e6;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    background-color: #f8f9fa;
    min-height: 100vh;
}

.page-content {
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* Asegurar que los inputs sean interactivos */
.page-content input,
.page-content textarea {
    position: relative;
    z-index: 2;
}

/* <select> no debe llevar position/z-index forzados: el menú nativo del
   navegador no es parte del stacking context local, y forzar esto dentro
   de contenedores flex (.app-container/.main-content) es una causa
   conocida de que el dropdown no se abra o se renderice mal en Chrome
   — reportado por un usuario como "el dropdown de dominios no se
   despliega correctamente". Sin este override el <select> sigue siendo
   100% interactivo (es nativo del navegador, no necesita ayuda de z-index). */

/* Sidebar */
.sidebar {
    background-color: #fff;
}

.sidebar-header {
    background-color: #f8f9fa;
}

.sidebar-heading {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.sidebar-link {
    padding: 8px 15px;
    color: #495057;
    border-radius: 5px;
    margin-bottom: 2px;
    transition: all 0.2s ease;
}

.sidebar-link:hover {
    background-color: #e9ecef;
    color: var(--primary-color);
}

.sidebar-link.active {
    background-color: var(--secondary-color);
    color: #fff !important;
}

.sidebar-link.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Navbar */
.navbar-main {
    height: var(--navbar-height);
    background-color: #fff !important;
}

/* Cards */
.stat-card,
.phase-card,
.project-card,
.evaluation-card,
.chat-card {
    border: none;
    border-radius: 10px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover,
.phase-card:hover,
.project-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
}

/* Phase Stepper */
.phase-stepper {
    padding: 20px 0;
}

.stepper-step {
    display: flex;
    align-items: center;
    flex: 1;
    position: relative;
}

.stepper-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
}

.stepper-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #e9ecef;
    color: #6c757d;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.stepper-step.completed .stepper-icon {
    background-color: var(--success-color);
    color: #fff;
}

.stepper-step.active .stepper-icon {
    background-color: var(--secondary-color);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.2);
}

.stepper-text {
    text-align: center;
}

.stepper-number {
    font-size: 0.75rem;
    color: #6c757d;
    display: block;
}

.stepper-name {
    font-size: 0.85rem;
    font-weight: 500;
}

.stepper-line {
    flex: 1;
    height: 2px;
    background-color: #e9ecef;
    margin: 0 10px;
    margin-top: -30px;
}

.stepper-step.completed + .stepper-step .stepper-line,
.stepper-step.completed .stepper-line {
    background-color: var(--success-color);
}

/* Chat */
.chat-card .card-header {
    background-color: #fff;
    border-bottom: 1px solid #e9ecef;
}

.chat-messages {
    display: flex;
    flex-direction: column;
}

.chat-message {
    max-width: 85%;
}

.chat-message.agent-message {
    align-self: flex-start;
}

.chat-message.user-message {
    align-self: flex-end;
}

.message-content {
    word-wrap: break-word;
}

.typing-indicator {
    display: flex;
    align-items: center;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: #6c757d;
    border-radius: 50%;
    margin-right: 4px;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-5px);
    }
}

/* Artifact Editor */
.artifact-editor {
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    border: 1px solid #dee2e6;
    border-radius: 5px;
}

.artifact-preview {
    border: 1px solid #dee2e6;
}

/* Code Editor */
.code-block {
    background-color: #2d3748;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    overflow-x: auto;
}

/* Mermaid Diagrams */
.mermaid {
    background-color: #fff;
    border-radius: 8px;
    padding: 20px;
}

/* Tables */
.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    font-size: 0.875rem;
}

/* Badges */
.badge {
    font-weight: 500;
}

/* Progress bars */
.progress {
    border-radius: 10px;
    overflow: hidden;
}

/* Alerts */
.alert {
    border: none;
    border-radius: 8px;
}

/* Buttons */
.btn {
    border-radius: 6px;
    font-weight: 500;
}

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

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

/* Status dot */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar-container {
        width: 60px;
        overflow: visible;
    }

    .sidebar-container:hover {
        width: var(--sidebar-width);
    }

    .main-content {
        margin-left: 60px;
    }

    .sidebar-container:not(:hover) .sidebar-header h4,
    .sidebar-container:not(:hover) .sidebar-header small,
    .sidebar-container:not(:hover) .sidebar-heading,
    .sidebar-container:not(:hover) .sidebar-link span,
    .sidebar-container:not(:hover) .sidebar-footer {
        display: none;
    }
}

@media (max-width: 768px) {
    .sidebar-container {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar-container.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
}

/* Animations */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading spinner */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Consola de salida de Fases/Pipeline: el tema Flatly define "bg-dark" como
   un azul-gris claro (#2c3e50) y "text-muted" como un gris (#95a5a6) pensado
   para fondos claros — contra ese bg-dark el contraste de text-muted cae por
   debajo de 4.5:1 (WCAG AA). Se fija un fondo casi negro real y colores
   explícitos de alto contraste para cada clase usada dentro de la consola. */
#consola-salida-fases {
    background-color: #1a1a1a !important;
    color: #e4e4e4;
}
#consola-salida-fases .text-success { color: #4ade80 !important; }
#consola-salida-fases .text-info { color: #60a5fa !important; }
#consola-salida-fases .text-warning { color: #fbbf24 !important; }
#consola-salida-fases .text-danger { color: #f87171 !important; }
#consola-salida-fases .text-muted { color: #b0b8c1 !important; }
#consola-salida-fases .text-light { color: #e4e4e4 !important; }
