/* task-manager.css - Estilos del Sistema de Tareas */
/* INTRANEURO - Sistema de Gestión Hospitalaria */

/* ========================================
   CONTENEDOR PRINCIPAL
   ======================================== */
.task-manager-container {
    background: #ffffff;
    border-radius: 0;
    padding: 0;
    margin-top: 0;
}

.task-manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e7eb;
}

.task-manager-header h2,
.task-manager-header h3 {
    font-size: 1.2em;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: none; /* Anular el border del modal-section h2 */
    padding-bottom: 0;
}

.task-count-badge {
    /* Sin background, mismo estilo que el título */
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    margin-right: 4px;
}

.btn-new-task {
    background: #5DADE2;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(93, 173, 226, 0.3);
}

.btn-new-task:hover {
    background: #4A9FD3;
    box-shadow: 0 4px 8px rgba(93, 173, 226, 0.4);
    transform: translateY(-1px);
}

.btn-new-task:active {
    transform: translateY(0);
}

/* ========================================
   LISTA DE TAREAS
   ======================================== */
.task-list-container {
    max-height: 500px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Scrollbar personalizado */
.task-list-container::-webkit-scrollbar {
    width: 8px;
}

.task-list-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.task-list-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.task-list-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ========================================
   ITEM DE TAREA
   ======================================== */
.task-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.task-item:hover {
    background: #f1f5f9;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.task-item.task-completed {
    background: #e8f5e9;
    border-color: #a5d6a7;
}

.task-item.task-completed:hover {
    background: #dcedc8;
}

/* Checkbox */
.task-checkbox {
    font-size: 1.5em;
    cursor: pointer;
    user-select: none;
    color: #cbd5e1;
    transition: all 0.2s ease;
    line-height: 1;
}

.task-checkbox:hover {
    color: #94a3b8;
    transform: scale(1.1);
}

.task-completed .task-checkbox {
    color: #22c55e;
}

.task-completed .task-checkbox:hover {
    color: #16a34a;
}

/* Contenido */
.task-content {
    flex: 1;
    min-width: 0;
}

.task-text {
    font-size: 1em;
    color: #1f2937;
    font-weight: 500;
    margin-bottom: 6px;
    line-height: 1.4;
    word-wrap: break-word;
}

.task-completed .task-text {
    color: #059669;
    text-decoration: line-through;
    opacity: 0.8;
}

.task-meta {
    font-size: 0.85em;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 5px;
}

.task-completed-info {
    font-size: 0.85em;
    color: #059669;
    margin-top: 5px;
    font-weight: 500;
}

/* Acciones */
.task-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* ========================================
   BOTONES DE ACCIÓN
   ======================================== */
/* Botón eliminar tarea */
.task-delete-btn {
    background: white;
    border: 1px solid #e5e7eb;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    color: #ef4444;
    border-color: #ef4444;
}

.task-delete-btn:hover {
    background: #ef4444;
    color: white;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

/* ========================================
   ESTADO VACÍO
   ======================================== */
.task-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

.task-empty-state p:first-child {
    font-size: 2em;
    margin-bottom: 10px;
}

.task-empty-state p:nth-child(2) {
    font-size: 1.1em;
    font-weight: 500;
    margin-bottom: 5px;
    color: #64748b;
}

.task-empty-state p:last-child {
    font-size: 0.9em;
}

/* ========================================
   MODAL DE NUEVA TAREA
   ======================================== */
#newTaskModal .modal-content {
    animation: slideDown 0.2s ease-out;
}

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

#newTaskModal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 15px;
    border-bottom: 1px solid #e5e7eb;
}

#newTaskModal .modal-header h3 {
    margin: 0;
    font-size: 1.3em;
    font-weight: 600;
    color: #1f2937;
}

#newTaskModal .close-modal {
    background: none;
    border: none;
    font-size: 1.8em;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

#newTaskModal .close-modal:hover {
    background: #f3f4f6;
    color: #4b5563;
}

#newTaskModal .modal-body {
    padding: 20px;
}

#newTaskModal .modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e5e7eb;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .task-manager-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .btn-new-task {
        padding: 8px 14px;
        font-size: 0.85rem;
        gap: 6px;
    }

    .task-item {
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        gap: 6px 8px;
        padding: 10px;
    }

    /* Checkbox en la primera fila, primera columna */
    .task-checkbox {
        grid-column: 1;
        grid-row: 1;
        font-size: 1.3em;
        align-self: flex-start;
    }

    /* Contenido en la primera fila, segunda columna */
    .task-content {
        grid-column: 2;
        grid-row: 1;
        width: 100%;
    }

    /* Acciones en la segunda fila, segunda columna (abajo a la derecha) */
    .task-actions {
        grid-column: 2;
        grid-row: 2;
        justify-self: flex-end;
        margin-top: 4px;
    }

    .task-delete-btn {
        padding: 5px 10px;
        font-size: 0.85em;
    }
}

/* ========================================
   ANIMACIONES
   ======================================== */
@keyframes taskAdded {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.task-item.task-new {
    animation: taskAdded 0.3s ease-out;
}

/* ========================================
   UTILIDADES
   ======================================== */
.task-loading {
    text-align: center;
    padding: 20px;
    color: #94a3b8;
}

.task-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px;
    border-radius: 6px;
    margin: 10px 0;
    font-size: 0.9em;
}

/* ========================================
   NOTAS DE VOZ EN TAREAS
   ======================================== */

/* Botón para grabar nota de voz */
.task-audio-record-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-top: 10px;
    background: #f8fafc;
    border: 1.5px dashed #cbd5e1;
    border-radius: 50%;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.task-audio-record-btn:hover {
    background: #e0f2fe;
    border-color: #0ea5e9;
    color: #0ea5e9;
    transform: scale(1.05);
}

.task-audio-record-btn:active {
    transform: scale(0.95);
    background: #bae6fd;
}

.task-audio-record-btn svg {
    width: 18px;
    height: 18px;
}

/* Reproductor de audio compacto */
.task-audio-player {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 6px 10px 6px 6px;
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border-radius: 20px;
    border: 1px solid #86efac;
}

/* Botón de reproducir */
.task-audio-play-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #22c55e;
    color: white;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.task-audio-play-btn:hover {
    background: #16a34a;
    transform: scale(1.02);
}

.task-audio-play-btn:active {
    transform: scale(0.98);
}

/* Botón eliminar audio */
.task-audio-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #6b7280;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.task-audio-delete-btn:hover {
    background: #fecaca;
    color: #dc2626;
}

/* Indicador de grabación activa */
.task-recording-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
    border-radius: 8px;
    border: 1px solid #f87171;
    animation: recording-glow 1.5s ease-in-out infinite;
}

@keyframes recording-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.4);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.2);
    }
}

.task-recording-time {
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
    font-size: 14px;
    font-weight: 600;
    color: #dc2626;
    min-width: 40px;
}

/* Estado de tarea en grabación */
.task-item.recording {
    border-color: #f87171;
    background: #fef2f2;
}

/* Ocultar botón de grabar en tareas completadas */
.task-completed .task-audio-record-btn {
    display: none;
}

/* ========================================
   RESPONSIVE - AUDIO EN TAREAS
   ======================================== */
@media (max-width: 768px) {
    .task-audio-record-btn {
        width: 40px;
        height: 40px;
    }

    .task-audio-record-btn svg {
        width: 20px;
        height: 20px;
    }

    .task-audio-player {
        padding: 5px 8px 5px 5px;
        gap: 5px;
    }

    .task-audio-play-btn {
        padding: 8px 14px;
        font-size: 14px;
    }

    .task-recording-controls {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        padding: 10px;
    }

    .task-recording-controls .btn {
        flex: 1;
        min-width: 100px;
    }
}

/* ========================================
   SECCIÓN DE AUDIO EN MODAL DE NUEVA TAREA
   ======================================== */

/* Contenedor de la sección de audio */
.new-task-audio-section {
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

/* Botón para iniciar grabación */
.btn-record-new-task {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #25D366;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(37, 211, 102, 0.3);
}

.btn-record-new-task:hover {
    background: #20BD5A;
    box-shadow: 0 4px 8px rgba(37, 211, 102, 0.4);
    transform: translateY(-1px);
}

.btn-record-new-task:active {
    transform: translateY(0);
}

/* UI de grabación activa en modal */
.new-task-recording-active {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
    border-radius: 8px;
    border: 1px solid #f87171;
    animation: recording-glow 1.5s ease-in-out infinite;
}

/* Indicador de grabación (punto rojo pulsante) */
.new-task-recording-indicator {
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    animation: pulse-recording 1s ease-in-out infinite;
}

@keyframes pulse-recording {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

/* Timer de grabación */
.new-task-recording-timer {
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
    font-size: 1.2em;
    font-weight: 600;
    color: #dc2626;
    min-width: 50px;
}

/* Reproductor de preview */
.new-task-audio-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border-radius: 8px;
    border: 1px solid #86efac;
}

/* Botón de reproducir en preview */
.btn-play-new-task {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #22c55e;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.15s ease;
}

.btn-play-new-task:hover {
    background: #16a34a;
    transform: scale(1.02);
}

.btn-play-new-task:active {
    transform: scale(0.98);
}

/* Duración del audio */
.new-task-audio-duration {
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
    font-size: 14px;
    font-weight: 500;
    color: #059669;
}

/* Botón eliminar audio en preview */
.btn-delete-new-task {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    color: #6b7280;
    font-size: 16px;
    transition: all 0.15s ease;
}

.btn-delete-new-task:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

/* ========================================
   RESPONSIVE - AUDIO EN MODAL NUEVA TAREA
   ======================================== */
@media (max-width: 768px) {
    .new-task-audio-section {
        padding: 0.75rem;
    }

    .btn-record-new-task {
        padding: 12px 18px;
        font-size: 15px;
        width: 100%;
        justify-content: center;
    }

    .new-task-recording-active {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        padding: 12px;
    }

    .new-task-recording-active .btn {
        flex: 1;
        min-width: 100px;
    }

    .new-task-audio-preview {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .btn-play-new-task {
        flex: 1;
        justify-content: center;
    }
}
