/* ═══════════════════════════════════════════
   TASKS SECTION
   ═══════════════════════════════════════════ */

/* ── Formulario ── */
.tasks-form-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--r-lg);
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 2px 18px rgba(0,0,0,0.2);
}

.tasks-form-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line-clr);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent-clr);
}

.tasks-form-header i {
    color: var(--green-bright);
    font-size: 15px;
}

.tasks-form-body {
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tasks-form-row {
    display: flex;
    gap: 12px;
}

/* Reutiliza .field-group de subjects.css */

.tasks-select,
.tasks-date-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(169, 204, 187, 0.18);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-clr);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease;
}

.tasks-select:focus,
.tasks-date-input:focus {
    border-color: rgba(61, 220, 151, 0.45);
    background: rgba(255, 255, 255, 0.07);
}

/* Color del calendario en dark */
.tasks-date-input::-webkit-calendar-picker-indicator {
    filter: invert(70%) sepia(20%) saturate(400%) hue-rotate(100deg);
    cursor: pointer;
    opacity: 0.6;
}
.tasks-date-input::-webkit-calendar-picker-indicator:hover { opacity: 1; }

/* Select arrow custom */
.tasks-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237fb89a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.tasks-select option {
    background: #082e21;
    color: var(--text-clr);
}

/* Textarea reutiliza .field-group input pero es textarea */
#task-description {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(169, 204, 187, 0.18);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-clr);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    resize: vertical;
    min-height: 64px;
    transition: border-color 160ms ease, background 160ms ease;
}

#task-description::placeholder { color: rgba(169, 204, 187, 0.35); }

#task-description:focus {
    border-color: rgba(61, 220, 151, 0.45);
    background: rgba(255, 255, 255, 0.07);
}

.label-optional {
    font-weight: 400;
    font-size: 10px;
    color: rgba(169, 204, 187, 0.4);
    text-transform: none;
    letter-spacing: 0;
}

.tasks-add-btn { width: 100%; }


/* ── Task cards ── */
#tasks-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--r-lg);
    padding: 14px 16px;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    gap: 6px 12px;
    transition: border-color 180ms ease, background 180ms ease;
    position: relative;
    overflow: hidden;
}

/* Franja de color por prioridad a la izquierda */
.task-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    border-radius: 0 2px 2px 0;
}

.task-card.priority-high::before    { background: #ff5050; }
.task-card.priority-medium::before  { background: #ffb932; }
.task-card.priority-low::before     { background: #3ddc97; }
.task-card.priority-overdue::before { background: #ff3030; }
.task-card.priority-completed::before { background: rgba(61,220,151,0.25); }

.task-card:hover {
    border-color: var(--card-border-hover);
    background: var(--card-bg-hover);
}

.task-card.completed-card {
    opacity: 0.55;
}

/* Fila 1: título + badge prioridad */
.task-card-top {
    display: flex;
    align-items: center;
    gap: 10px;
    grid-column: 1 / 2;
}

.task-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-clr);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-priority-badge {
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-high    { background: rgba(255,80,80,0.13);   color: #ff9090; border: 1px solid rgba(255,80,80,0.22);   }
.badge-medium  { background: rgba(255,185,50,0.13);  color: #ffd080; border: 1px solid rgba(255,185,50,0.22);  }
.badge-low     { background: rgba(61,220,151,0.13);  color: #7affc5; border: 1px solid rgba(61,220,151,0.22);  }
.badge-overdue { background: rgba(255,40,40,0.15);   color: #ff6060; border: 1px solid rgba(255,40,40,0.3);    }
.badge-completed { background: rgba(61,220,151,0.08); color: rgba(122,255,197,0.5); border: 1px solid rgba(61,220,151,0.12); }

/* Fila 2: meta info */
.task-card-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    grid-column: 1 / 2;
}

.task-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--secondary-text-clr);
}

.task-meta-item i {
    font-size: 11px;
    opacity: 0.7;
}

.task-subject-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Fila 3: descripción (si existe) */
.task-card-desc {
    font-size: 12.5px;
    color: rgba(232,239,233,0.45);
    grid-column: 1 / 2;
    line-height: 1.5;
}

/* Acciones — columna derecha, todas las filas */
.task-card-actions {
    grid-column: 2 / 3;
    grid-row: 1 / 4;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    align-self: center;
}

.task-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: background 150ms ease, transform 120ms ease;
}

.task-btn-complete {
    background: rgba(61, 220, 151, 0.1);
    color: #3ddc97;
    border: 1px solid rgba(61, 220, 151, 0.2);
}
.task-btn-complete:hover {
    background: rgba(61, 220, 151, 0.22);
    transform: scale(1.1);
}

.task-btn-delete {
    background: rgba(255, 80, 80, 0.08);
    color: #ff9090;
    border: 1px solid rgba(255, 80, 80, 0.18);
}
.task-btn-delete:hover {
    background: rgba(255, 80, 80, 0.18);
    transform: scale(1.1);
}

/* XP reward chip */
.task-xp-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    color: #ffd080;
    background: rgba(255,185,50,0.1);
    border: 1px solid rgba(255,185,50,0.2);
    border-radius: 999px;
    padding: 2px 8px;
}

/* Empty state */
#tasks-container:empty::after {
    content: 'No hay tareas aún.';
    display: block;
    text-align: center;
    padding: 2rem;
    font-size: 13px;
    color: rgba(169,204,187,0.3);
    font-style: italic;
}

/* ── Mobile ── */
@media (max-width: 800px) {
    .tasks-form-row { flex-direction: column; gap: 10px; }
    .task-card { padding: 12px 14px; }
}

/* ── Tarea completada ── */
.task-card.completed-card {
    opacity: 1;                          /* quitamos el opacity anterior */
    border-style: dashed;
    border-color: rgba(169, 204, 187, 0.2);
    background: rgba(255, 255, 255, 0.02);
}

.task-card.completed-card::before {
    background: rgba(169, 204, 187, 0.2); /* franja gris suave */
}

.task-card.completed-card .task-card-title {
    text-decoration: line-through;
    color: rgba(232, 239, 233, 0.35);
}

.task-card.completed-card .task-card-meta,
.task-card.completed-card .task-card-desc {
    opacity: 0.4;
}

.task-card.completed-card .task-xp-chip {
    opacity: 0.35;
}

/* Botón completar deshabilitado */
.task-btn-complete:disabled {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(169, 204, 187, 0.1);
    color: rgba(169, 204, 187, 0.25);
    cursor: not-allowed;
    transform: none;
}

/* Ícono reemplazado por guion cuando está completado */
.task-btn-complete.is-done {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(169, 204, 187, 0.1);
    color: rgba(169, 204, 187, 0.3);
    cursor: default;
    pointer-events: none;
}