/* styles.css for Lista de Tareas */

body {
    /* Bootstrap dark theme is already applied via HTML attribute */
    transition: background-color 0.3s ease, color 0.3s ease;
}

.app-container {
    max-width: 800px;
    margin: auto;
}

#task-input:focus,
#task-deadline:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, .25);
}

.task-item {
    transition: background-color 0.3s ease, opacity 0.3s ease;
    padding: 0.75rem 1.25rem;
    border-radius: .375rem; /* Bootstrap's default card/list-group-item radius */
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Slightly visible border in dark mode */
}

.task-item:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.task-item .form-check {
    display: flex;
    align-items: center;
    flex-grow: 1;
    margin-right: 1rem; /* Space before deadline/buttons */
}

.task-item .form-check-input {
    margin-top: 0; /* Align checkbox better with text */
    margin-right: 0.75rem;
    cursor: pointer;
    width: 1.25em; /* Larger checkbox */
    height: 1.25em; /* Larger checkbox */
}

.task-item .task-text {
    transition: color 0.3s ease, text-decoration 0.3s ease;
    flex-grow: 1;
    cursor: pointer;
    font-size: 1.05rem;
    word-break: break-word; /* Para textos largos */
}

.task-item .task-text:hover {
    color: #0d6efd;
    text-decoration: underline;
}

.task-item.selected {
    background-color: rgba(13, 110, 253, 0.1) !important;
    border-left: 3px solid #0d6efd !important;
}

/* Edit task styles */
.edit-task-input {
    border: 2px solid #0d6efd !important;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25) !important;
}

.edit-task-controls {
    margin-left: 0.5rem;
}

.edit-task-controls .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Mobile-specific styles for edit task */
@media (max-width: 767.98px) {
    .edit-task-input {
        font-size: 1rem !important;
        padding: 0.75rem !important;
        margin-bottom: 0.5rem;
    }
    
    .edit-task-controls {
        margin-left: 0;
        margin-top: 0.5rem;
        justify-content: center;
    }
    
    .edit-task-controls .btn {
        padding: 0.75rem 1rem;
        font-size: 1rem;
        margin: 0 0.25rem;
        min-width: 60px;
    }
    
    .edit-task-controls .btn i {
        font-size: 1.1rem;
    }
}

.task-item.completed-task .task-text {
    text-decoration: line-through;
    color: #6c757d; /* Bootstrap's secondary color */
}

.task-details {
    display: flex;
    align-items: center;
    flex-shrink: 0; /* Prevent shrinking when task text is long */
    gap: 0.5rem; /* Espacio entre deadline and buttons */
    white-space: nowrap; /* Evitar que los detalles se envuelvan demasiado pronto */
}

.task-deadline {
    font-size: 0.85em;
    color: #adb5bd; /* Bootstrap's gray-500 */
}

.task-deadline-tag {
    font-size: 0.75em;
    padding: .25em .5em;
    min-width: 60px; /* Ensure consistent width */
    text-align: center;
    border-radius: 0.25rem;
    font-weight: bold;
}

/* Deadline colors */
.deadline-green {
    background-color: #198754 !important; /* Bootstrap success */
    color: white;
}

.deadline-yellow {
    background-color: #ffc107 !important; /* Bootstrap warning */
    color: black;
}

.deadline-red {
    background-color: #dc3545 !important; /* Bootstrap danger */
    color: white;
}

.deadline-overdue {
    background-color: #495057 !important; /* Bootstrap dark grey / custom darker red */
    color: #ced4da;
    /* text-decoration: line-through; */
}

/* Animations */
.task-added {
    animation: fadeIn 0.5s ease;
}

.task-removed {
    animation: fadeOut 0.5s ease forwards;
}

.task-completed-animation {
    animation: pulseBg 0.5s ease;
}

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

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
        height: 0; /* Collapse space */
        padding-top: 0;
        padding-bottom: 0;
        margin-bottom: 0;
        border: none;
        overflow: hidden; /* Prevent content from showing during collapse */
    }
}

@keyframes pulseBg {
    0% {
        background-color: rgba(var(--bs-success-rgb), 0.25);
    }
    50% {
        background-color: rgba(var(--bs-success-rgb), 0.5);
    }
    100% {
        background-color: transparent; /* Or initial bg color of completed task */
    }
}

/* Responsive adjustments */
@media (max-width: 767.98px) { /* Bootstrap's md breakpoint */
    #add-task-section .row > div {
        margin-bottom: 0.75rem; /* Add some space between inputs and button on mobile */
    }
    #add-task-section .row .col-md-2 button {
        width: 100% !important;
    }

    .task-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .task-item .form-check {
        margin-bottom: 0.5rem; /* Space between checkbox/text and details on mobile */
        width: 100%; /* Ensure it takes full width */
    }

    .task-details {
        width: 100%;
        justify-content: space-between; /* Distribute items in details */
        margin-top: 0.5rem;
    }

    .task-deadline-tag {
        order: -1; /* Show badge first on mobile if desired, or adjust as needed */
        margin-bottom: 0.25rem;
    }

    .task-deadline {
        margin-right: auto; /* Push buttons to the right */
    }
}

#task-counters span {
    margin: 0 0.5rem;
}

#empty-list-message {
    font-style: italic;
}

/* Utility class for subtle animation on buttons/interactive elements */
.interactive-hover {
    transition: transform 0.1s ease-in-out, box-shadow 0.1s ease-in-out;
}

.interactive-hover:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#delete-completed-btn,
#delete-all-btn {
    min-width: 180px; /* Ensure buttons have decent width */
}

/* Estilo para el mensaje de lista vacía */
#empty-list-message i {
    color: #6c757d;
}

/* SortableJS helper classes (optional styling) */
.sortable-ghost {
  opacity: 0.4;
  background-color: rgba(0, 123, 255, 0.1); /* Un azul claro translúcido */
}

.sortable-chosen {
  /* background-color: #f0f0f0; */ /* Un color de fondo sutil cuando se elige */
}

.sortable-drag {
  opacity: 0.9;
  /* box-shadow: 0 4px 8px rgba(0,0,0,0.1); */ /* Sombra sutil al arrastrar */
}

/* Clases interactivas para simular :hover en JS o para estados activos */
.interactive-hover:hover,
.interactive-hover:focus {
    filter: brightness(1.1);
    transform: translateY(-1px);
    transition: filter 0.2s ease-out, transform 0.2s ease-out;
}

/* Estilos para el ícono de eliminar pestaña */
.nav-link .delete-tab-icon {
    /* position: absolute; */ /* Eliminado según solicitud */
    /* top: 2px; */
    /* right: 5px; */
    font-size: 1.1em; /* Ajustado ligeramente */
    font-weight: bold;
    color: #dc3545;
    cursor: pointer;
    padding: 0 2px 0 6px; /* Ajustar padding para flujo normal LTRB*/
    line-height: 1;
    display: inline-block;
    /* z-index: 10; */ /* No necesario sin position:absolute */
    margin-left: 8px; /* Espacio entre el nombre y el ícono */
}

.nav-link .delete-tab-icon:hover {
    color: #a71d2a;
}

/* Ajustar el padding del botón de la pestaña y usar flexbox */
.nav-tabs .nav-link {
    padding-right: 10px !important; /* Reducir padding derecho, el ícono ahora está en flujo */
    display: flex !important; /* Usar flex para alinear nombre e ícono */
    justify-content: space-between !important; /* Nombre a la izquierda, ícono a la derecha */
    align-items: center !important; /* Centrar verticalmente */
}

.nav-tabs .nav-link .tab-name {
    flex-grow: 1; /* El nombre de la pestaña ocupa el espacio disponible */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Prevenir que nombres largos rompan el layout */
}

/* Asegurar que el botón de añadir pestaña no se vea afectado por flex si es un nav-link también */
#add-tab-btn.nav-link {
    justify-content: center !important; /* Centrar el ícono + si es un nav-link */
}

/* Filter section styles */
#filters-section {
    border-left: 4px solid #0d6efd;
}

#filters-content.show-filters {
    display: flex !important;
}

#filters-section .form-label {
    font-weight: 500;
    color: #adb5bd;
}

/* Category and priority badges */
.task-details .badge {
    font-size: 0.7em;
    padding: 0.25em 0.5em;
    border-radius: 0.375rem;
    font-weight: 500;
}

/* Detailed stats section */
#detailed-stats {
    border-left: 4px solid #28a745;
}

#stats-content.show-stats {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: space-around;
    align-items: stretch;
}

.stat-item {
    padding: 0.5rem;
    border-radius: 0.375rem;
    background-color: rgba(255, 255, 255, 0.05);
    transition: transform 0.2s ease;
    flex: 1;
    min-width: 120px;
    margin: 0.25rem;
}

.stat-item:hover {
    transform: translateY(-2px);
    background-color: rgba(255, 255, 255, 0.1);
}

.stat-item i {
    font-size: 1.5rem;
    display: block;
}

.stat-label {
    font-size: 0.8rem;
    color: #adb5bd;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Keyboard shortcuts styling */
kbd {
    background-color: #495057;
    color: #fff;
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
    font-size: 0.85em;
    font-family: monospace;
}

/* Toast notifications */
.toast {
    min-width: 250px;
}

/* Responsive adjustments for new form layout */
@media (max-width: 991.98px) {
    #add-task-section .row > div {
        margin-bottom: 0.75rem;
    }
    
    #add-task-section .row .col-lg-1 button {
        width: 100% !important;
    }
}

@media (max-width: 767.98px) {
    #filters-section .row > div {
        margin-bottom: 0.75rem;
    }
    
    #filters-section .row .col-md-12 button {
        width: 100% !important;
    }
    
    /* Hide keyboard shortcuts on mobile */
    header small {
        display: none;
    }
}

/* Edit task form styles */
.edit-task-form {
    margin-top: 1rem;
    border: 2px solid #007bff !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    animation: fadeIn 0.3s ease;
}

.edit-task-form .form-control,
.edit-task-form .form-select {
    border-color: #007bff;
}

.edit-task-form .form-control:focus,
.edit-task-form .form-select:focus {
    border-color: #0056b3;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.edit-task-form .btn {
    min-width: 120px;
}

/* Mobile styles for edit form */
@media (max-width: 767.98px) {
    .edit-task-form {
        margin-top: 0.75rem;
        padding: 1rem !important;
    }
    
    .edit-task-form .btn {
        min-width: 100px;
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
    
    .edit-task-form .form-control,
    .edit-task-form .form-select {
        font-size: 1rem;
        padding: 0.75rem;
    }
}

/* Drag and drop disabled indicator */
.drag-disabled {
    cursor: default !important;
}

.drag-disabled .task-item {
    cursor: default !important;
}

.drag-disabled .task-item:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* Show a subtle indicator when drag is disabled */
.drag-disabled::before {
    content: "🔄 Modo edición - Arrastrar deshabilitado";
    display: block;
    text-align: center;
    font-size: 0.8rem;
    color: #6c757d;
    background: rgba(108, 117, 125, 0.1);
    padding: 0.5rem;
    margin-bottom: 1rem;
    border-radius: 0.375rem;
    border: 1px dashed #6c757d;
}

/* Help modal styles */
#helpActionsModal .card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#helpActionsModal .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

#helpActionsModal .card-header {
    font-weight: 600;
}

#helpActionsModal .list-unstyled li {
    margin-bottom: 0.5rem;
}

#helpActionsModal .list-unstyled li:last-child {
    margin-bottom: 0;
}

#helpActionsModal .alert {
    border-left: 4px solid #17a2b8;
}

/* Task Description Styles */
.task-description-section {
    margin-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 0.5rem;
}

.task-description-content {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #adb5bd;
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

.task-description-content a {
    color: #0d6efd;
    text-decoration: underline;
    word-break: break-all;
}

.task-description-content a:hover {
    color: #0a58ca;
    text-decoration: none;
}

.toggle-description-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: transparent;
    color: #adb5bd;
    transition: all 0.2s ease;
}

.toggle-description-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.toggle-description-btn i {
    transition: transform 0.2s ease;
}

.toggle-description-btn:hover i {
    transform: scale(1.1);
}

/* Mobile styles for description */
@media (max-width: 767.98px) {
    .toggle-description-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .task-description-content {
        font-size: 0.85rem;
        padding: 0.75rem !important;
    }
}

/* Mobile add task button styles */
@media (max-width: 991.98px) {
    #add-task-btn-mobile {
        margin-top: 0.5rem;
    }
    
    #add-task-btn-mobile-btn {
        font-size: 1.1rem;
        padding: 0.75rem 1.5rem;
        font-weight: 500;
    }
} 

@media (min-width: 992px) { /* lg breakpoint */
    #add-task-btn-container {
        display: flex!important;
        justify-content: flex-end;
        flex-direction: column;
    }
}
@media (max-width: 992px) {
    .task-details {
        flex-wrap: wrap;
        flex-direction: row;
        justify-content: flex-start;
    }
    .task-details > button {
        order: 2;
    }

    .task-details > span,
    .task-details > small {
        order: 1;
    }
    
    .task-details::after {
        content: "";
        flex-basis: 100%;
        width: 0;
        order: 1;
    }

}

