/**
 * Estilos para el área pública de ChidoLingo Tareas
 */

/* Estilos generales */
.chidolingo-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #333;
    line-height: 1.6;
    max-width: 100%;
    margin: 20px auto;
    padding: 0;
    padding-bottom: 120px !important; /* Espacio importante para evitar colisión con el footer */
    margin-bottom: 50px !important;
}

/* Espacio adicional para el área de la tarea */
.task-content-wrapper {
    margin-bottom: 30px !important;
    padding: 15px !important;
}

/* Espacio entre botones y bordes */
.task-actions {
    padding: 20px 0 !important;
    margin-bottom: 40px !important;
}

/* Mejora de botones */
.chidolingo-button {
    padding: 10px 15px !important;
    margin-right: 10px !important;
    border-radius: 4px !important;
}

.chidolingo-container * {
    box-sizing: border-box;
}

.chidolingo-header {
    margin-top: 0;
    margin-bottom: 20px;
    font-weight: 600;
    color: #23282d;
    font-size: 1.8em;
}

/* Barra de progreso */
.chidolingo-progress-summary {
    margin-bottom: 20px;
}

.chidolingo-progress-bar {
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.chidolingo-progress-bar .progress-fill {
    height: 100%;
    background: #0073aa;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.chidolingo-progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
}

/* Dashboard de 3 columnas */
.chidolingo-dashboard {
    display: flex;
    flex-wrap: wrap;
    gap: 30px !important;
    margin: 20px 0;
    padding: 0 10px !important;
}

/* Mejor definición del editor */
.wp-editor-container {
    border: 1px solid #ddd !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
    margin-bottom: 25px !important;
}

/* Espacio adicional en la barra de navegación */
.nivel-heading, .tasks-section-title {
    padding: 12px 18px !important;
}

.chidolingo-dashboard-column {
    flex: 1 1 300px;
}

.chidolingo-dashboard-column.column-1 {
    flex: 1 1 250px;
}

.chidolingo-dashboard-column.column-2 {
    flex: 2 1 400px;
}

.chidolingo-dashboard-column.column-3 {
    flex: 1 1 280px;
}

.chidolingo-box {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    overflow: hidden;
}

.chidolingo-box-header {
    background: #f9f9f9;
    padding: 12px 15px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chidolingo-box-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chidolingo-box-content {
    padding: 15px;
}

.chidolingo-box-footer {
    padding: 10px 15px;
    background: #f9f9f9;
    border-top: 1px solid #e5e5e5;
    text-align: right;
}

/* Lista de tareas (Columna 1) */
.chidolingo-tasks-list {
    max-height: 600px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.chidolingo-tasks-list::-webkit-scrollbar {
    width: 6px;
}

.chidolingo-tasks-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chidolingo-tasks-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.chidolingo-task-filters {
    padding: 10px 15px;
    border-bottom: 1px solid #e5e5e5;
}

.chidolingo-task-filters input {
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.chidolingo-filters {
    display: flex;
    gap: 10px;
}

.chidolingo-filters select {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.tasks-section-title {
    padding: 10px 15px;
    margin: 0;
    font-weight: 600;
    border-bottom: 1px solid #f0f0f0;
    background: #f9f9f9;
}

.nivel-heading {
    padding: 10px 15px;
    margin: 0;
    font-weight: 600;
    border-bottom: 1px solid #f0f0f0;
    background: #f5f5f5;
}

.task-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.chidolingo-task-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
}

.chidolingo-task-item:hover {
    background: #f5f9ff;
}

.chidolingo-task-item.active {
    background: #eaf5ff;
    border-left: 3px solid #0073aa;
}

.chidolingo-task-status {
    margin-right: 12px;
    flex-shrink: 0;
}

.chidolingo-task-status .status-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #f0f0f0;
    border: 2px solid #ddd;
    position: relative;
}

.chidolingo-task-status .status-icon.pendiente {
    background: #f0f0f0;
    border-color: #ddd;
}

.chidolingo-task-status .status-icon.en_progreso {
    background: #fff9c4;
    border-color: #ffd600;
}

.chidolingo-task-status .status-icon.completada {
    background: #fff;
    border-color: #ff9800;
}

.chidolingo-task-status .status-icon.aprobada {
    background: #e8f5e9;
    border-color: #4caf50;
}

.chidolingo-task-status .status-icon.aprobada:after {
    content: "";
    position: absolute;
    width: 8px;
    height: 4px;
    border-left: 2px solid #4caf50;
    border-bottom: 2px solid #4caf50;
    transform: rotate(-45deg);
    left: 4px;
    top: 6px;
}

.chidolingo-task-details {
    flex-grow: 1;
}

.chidolingo-task-details h4 {
    margin: 0 0 3px 0;
    font-size: 14px;
    font-weight: 600;
}

.chidolingo-task-meta {
    font-size: 12px;
    color: #666;
    display: flex;
    gap: 8px;
}

.chidolingo-level-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 600;
    font-size: 11px;
}

.chidolingo-level-badge.a1 { background: #e6f7ff; color: #0066cc; }
.chidolingo-level-badge.a2 { background: #e6fffa; color: #009688; }
.chidolingo-level-badge.b1 { background: #fff9e6; color: #cc9900; }
.chidolingo-level-badge.b2 { background: #fff2e6; color: #cc6600; }
.chidolingo-level-badge.c1 { background: #f7e6ff; color: #6600cc; }
.chidolingo-level-badge.c2 { background: #ffe6e6; color: #cc0000; }

/* Editor de tareas (Columna 2) */
.chidolingo-task-editor {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.editor-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #666;
}

.editor-loading i {
    font-size: 24px;
    margin-bottom: 10px;
    color: #0073aa;
}

.welcome-recommendations {
    margin-top: 20px;
}

.welcome-recommendations h4 {
    margin-bottom: 10px;
    font-size: 16px;
}

.welcome-recommendations ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.welcome-recommendations li {
    margin-bottom: 8px;
}

.task-recommendation {
    display: block;
    padding: 10px;
    background: #f5f9ff;
    border: 1px solid #e3f2fd;
    border-radius: 4px;
    text-decoration: none;
    color: #0066cc;
    transition: background 0.2s;
}

.task-recommendation:hover {
    background: #e3f2fd;
}

.task-recommendation .task-nivel {
    float: right;
    font-size: 12px;
    background: #e6f7ff;
    color: #0066cc;
    padding: 1px 6px;
    border-radius: 3px;
}

/* Asistente IA (Columna 3) */
.chidolingo-assistant {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.chidolingo-assistant-header {
    padding: 12px 15px;
    border-bottom: 1px solid #e5e5e5;
    background: #f5f5f5;
    display: flex;
    align-items: center;
}

.chidolingo-assistant-icon {
    margin-right: 10px;
    width: 32px;
    height: 32px;
    background: #0073aa;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.chidolingo-assistant-header h3 {
    margin: 0;
    font-size: 16px;
}

.chidolingo-assistant-status {
    margin-left: auto;
    font-size: 12px;
}

.chidolingo-assistant-status .status-online {
    color: #4caf50;
}

.chidolingo-assistant-messages {
    flex-grow: 1;
    height: 350px !important; /* Más espacio para mensajes */
    overflow-y: auto;
    padding: 20px !important;
    background: #f9f9f9;
    border-bottom: 1px solid #e5e5e5;
}

/* Mejorar contraste del asistente */
.chidolingo-message-content p {
    color: #333 !important; /* Texto más oscuro */
    font-size: 15px !important;
    line-height: 1.5 !important;
}

.chidolingo-assistant {
    margin-bottom: 40px !important;
}

/* Botones de acciones rápidas más grandes */
.chidolingo-quick-action {
    padding: 8px 12px !important;
    font-size: 14px !important;
}

/* Mejorar área de entrada */
.chidolingo-assistant-input textarea {
    padding: 12px 15px !important;
    font-size: 15px !important;
}

.chidolingo-message {
    margin-bottom: 15px;
    max-width: 85%;
}

.chidolingo-message.assistant-message {
    margin-right: auto;
}

.chidolingo-message.user-message {
    margin-left: auto;
}

.chidolingo-message.error-message {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.chidolingo-message-content {
    padding: 10px 12px;
    border-radius: 12px;
    position: relative;
}

.assistant-message .chidolingo-message-content {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top-left-radius: 0;
}

.user-message .chidolingo-message-content {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-top-right-radius: 0;
    color: #0d47a1;
}

.error-message .chidolingo-message-content {
    background: #ffebee;
    border: 1px solid #ffcdd2;
    color: #c62828;
}

.chidolingo-assistant-controls {
    padding: 12px 15px;
}

.chidolingo-quick-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.chidolingo-quick-action {
    padding: 6px 10px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 15px;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.chidolingo-quick-action:hover {
    background: #e3f2fd;
    border-color: #bbdefb;
}

.chidolingo-assistant-input {
    display: flex;
    border: 1px solid #ddd;
    border-radius: 18px;
    background: #fff;
    overflow: hidden;
}

.chidolingo-assistant-input textarea {
    flex-grow: 1;
    border: none;
    padding: 10px 15px;
    resize: none;
    min-height: 40px;
    max-height: 100px;
    outline: none;
}

.chidolingo-send-button {
    background: #0073aa;
    color: #fff;
    border: none;
    width: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chidolingo-send-button:hover {
    background: #005177;
}

.chidolingo-assistant-quota {
    margin-top: 8px;
    text-align: right;
    font-size: 11px;
    color: #666;
}

/* Estilos para resultados de tarea */
.task-results {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-top: 30px;
    margin-bottom: 50px;
    padding: 20px;
    animation: slide-up 0.4s ease-out;
}

@keyframes slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.results-header h3 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.results-score {
    display: flex;
    align-items: baseline;
}

.score-value {
    font-size: 32px;
    font-weight: bold;
}

.score-label {
    font-size: 18px;
    margin-left: 3px;
    opacity: 0.7;
}

.results-status {
    margin-bottom: 15px;
    font-weight: 500;
}

.status-aprobada {
    color: #4caf50;
    font-weight: bold;
}

.status-completada {
    color: #ff9800;
    font-weight: bold;
}

.results-feedback {
    background: #f9f9f9;
    border-left: 4px solid #2196f3;
    padding: 15px;
    margin-top: 15px;
}

.results-feedback h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #2196f3;
}

.feedback-content {
    line-height: 1.7;
}

/* Botones de acciones rápidas más visibles */
.chidolingo-quick-action {
    padding: 8px 12px !important;
    font-size: 14px !important;
    background-color: #f5f5f5 !important;
    border: 1px solid #ddd !important;
    border-radius: 15px !important;
}

.chidolingo-quick-action:hover {
    background-color: #e3f2fd !important;
    border-color: #bbdefb !important;
}

/* Mejor estilo botones principales */
.chidolingo-button.primary {
    background-color: #0073aa !important;
    color: white !important;
    font-weight: bold !important;
    padding: 10px 20px !important;
    transition: background-color 0.2s !important;
}

.chidolingo-button.primary:hover {
    background-color: #005177 !important;
}

.chidolingo-button {
    background-color: #f0f0f0 !important;
    border: 1px solid #ddd !important;
    font-weight: 500 !important;
    margin-right: 8px !important;
}

/* Notificaciones */
.chidolingo-notice {
    position: fixed;
    top: 50px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 9999;
    max-width: 400px;
    animation: slide-in 0.3s ease-out;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.chidolingo-notice.success {
    background-color: #dff0d8;
    border-left: 4px solid #5cb85c;
    color: #3c763d;
}

.chidolingo-notice.error {
    background-color: #f2dede;
    border-left: 4px solid #d9534f;
    color: #a94442;
}

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

/* Responsive */
@media screen and (max-width: 992px) {
    .chidolingo-dashboard {
        flex-direction: column;
    }
    
    .chidolingo-dashboard-column {
        flex-basis: 100%;
    }
}

@media screen and (max-width: 576px) {
    .chidolingo-task-filters {
        padding: 8px;
    }
    
    .chidolingo-filters {
        flex-direction: column;
    }
    
    .chidolingo-filters select {
        margin-bottom: 5px;
    }
    
    .chidolingo-assistant-icon {
        width: 24px;
        height: 24px;
    }
    
    .chidolingo-quick-actions {
        flex-wrap: wrap;
    }
}