/* ==========================================
   SHARED TODO STYLES (tt- prefix)
   Used by /todo page and dashboard widget
   ========================================== */

/* ---- Todo Item ---- */
.tt-item {
    position: relative;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: transparent;
    transition: background 0.25s ease;
    animation: tt-fadeUp 0.35s ease both;
}
.tt-item + .tt-item {
    border-top: 1px solid var(--tw-border-light, rgba(0,0,0,0.05)) !important;
}
.tt-item:hover {
    background: var(--tw-bg-hover, rgba(59,121,177,0.03));
}
.tt-item--done {
    background: rgba(52, 211, 153, 0.04);
}
.tt-item--done:hover {
    background: rgba(52, 211, 153, 0.07);
}

.tt-item-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 28px;
    min-height: 62px;
}

/* ---- Drag Handle ---- */
.tt-item-drag {
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tw-text-muted, rgba(0,0,0,0.2));
    cursor: grab;
    opacity: 0;
    transition: opacity 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
    font-size: 13px;
}
.tt-item:hover .tt-item-drag {
    opacity: 1;
}
.tt-item-drag:active {
    cursor: grabbing;
    color: var(--tw-primary, #3B79B1);
}

/* ---- Custom Checkbox ---- */
.tt-checkbox-wrap {
    position: relative;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tt-checkbox-wrap input[type="checkbox"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
    margin: 0 !important;
}
.tt-checkmark {
    width: 22px;
    height: 22px;
    border: 2px solid var(--tw-border, rgba(0,0,0,0.15));
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fff;
    flex-shrink: 0;
}
.tt-checkbox-wrap input:checked ~ .tt-checkmark {
    background: var(--tw-primary, #3B79B1);
    border-color: var(--tw-primary, #3B79B1);
    box-shadow: 0 2px 8px rgba(59,121,177,0.3);
}
.tt-checkmark::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: -2px;
}
.tt-checkbox-wrap input:checked ~ .tt-checkmark::after {
    transform: rotate(45deg) scale(1);
}

/* ---- Item Content ---- */
.tt-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.tt-item-content label {
    margin: 0 !important;
    cursor: pointer;
}
.tt-item-text {
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, sans-serif;
    font-size: 15px !important;
    font-weight: 500;
    color: var(--tw-text, #111) !important;
    margin: 0;
    line-height: 1.4;
    word-break: break-word;
    transition: color 0.25s ease;
}
.tt-item--done .tt-item-text,
.tt-item--done .tt-item-text s {
    color: var(--tw-text-muted, rgba(0,0,0,0.35)) !important;
}
.tt-item-date {
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, sans-serif;
    font-size: 12px;
    color: var(--tw-text-muted, rgba(0,0,0,0.35));
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.tt-item-date i {
    font-size: 11px;
}

/* ---- Action Buttons ---- */
.tt-item-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.tt-item:hover .tt-item-actions {
    opacity: 1;
}
.tt-action-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    border: none;
    background: transparent;
}
.tt-action-edit {
    color: var(--tw-primary, #3B79B1);
}
.tt-action-edit:hover {
    background: rgba(59,121,177,0.1);
    color: var(--tw-primary-dark, #2C5AA0);
}
.tt-action-delete {
    color: var(--tw-text-muted, rgba(0,0,0,0.3));
}
.tt-action-delete:hover {
    background: rgba(239,68,68,0.1);
    color: var(--tw-error, #EF4444);
}

/* ---- Input Area ---- */
.tt-input-area {
    padding: 24px 28px;
    border-bottom: 1px solid var(--tw-border-light, rgba(0,0,0,0.06));
}
.tt-input-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
}
.tt-input-wrap {
    flex: 1;
    position: relative;
}
.tt-input-wrap .tt-input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tw-text-muted, rgba(0,0,0,0.3));
    font-size: 14px;
    pointer-events: none;
    transition: color 0.25s ease;
}
.tt-input-wrap input.form-control {
    height: 52px !important;
    padding: 12px 16px 12px 44px !important;
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, sans-serif !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    border-radius: 14px !important;
    border: 2px solid var(--tw-border, rgba(0,0,0,0.08)) !important;
    background: var(--tw-bg-page, #F2F2F7) !important;
    transition: all 0.25s ease !important;
}
.tt-input-wrap input.form-control:focus {
    background: #fff !important;
    border-color: var(--tw-primary, #3B79B1) !important;
    box-shadow: 0 0 0 4px rgba(59,121,177,0.1) !important;
}
.tt-input-wrap input.form-control:focus ~ .tt-input-icon {
    color: var(--tw-primary, #3B79B1);
}
.tt-add-btn {
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, sans-serif !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    padding: 12px 28px !important;
    border-radius: 14px !important;
    border: none !important;
    color: #fff !important;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer;
}
.tt-add-btn.btn-primary {
    background: linear-gradient(135deg, var(--tw-primary, #3B79B1), var(--tw-primary-dark, #2C5AA0)) !important;
    box-shadow: 0 4px 16px rgba(59,121,177,0.3) !important;
}
.tt-add-btn.btn-success {
    background: linear-gradient(135deg, var(--tw-accent, #34D399), #059669) !important;
    box-shadow: 0 4px 16px rgba(52,211,153,0.3) !important;
}
.tt-add-btn:hover {
    transform: translateY(-1px) !important;
}
.tt-add-btn:active {
    transform: translateY(0) !important;
}

/* ---- Empty State ---- */
.tt-empty {
    padding: 60px 28px;
    text-align: center;
}
.tt-empty-icon {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(59,121,177,0.08), rgba(52,211,153,0.08));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 28px;
    color: var(--tw-primary, #3B79B1);
}
.tt-empty-title {
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--tw-text, #111);
    margin: 0 0 8px;
}
.tt-empty-desc {
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, sans-serif;
    font-size: 14px;
    color: var(--tw-text-muted, rgba(0,0,0,0.38));
    margin: 0;
}

/* ---- Sortable ---- */
.sortable-ghost {
    opacity: 0.4;
    background: rgba(59,121,177,0.06) !important;
    border-radius: 12px;
}
.sortable-chosen {
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    background: #fff !important;
    border-radius: 12px;
}

/* ---- Animation ---- */
@keyframes tt-fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.sort .tt-item:nth-child(1) { animation-delay: 0.03s; }
.sort .tt-item:nth-child(2) { animation-delay: 0.06s; }
.sort .tt-item:nth-child(3) { animation-delay: 0.09s; }
.sort .tt-item:nth-child(4) { animation-delay: 0.12s; }
.sort .tt-item:nth-child(5) { animation-delay: 0.15s; }
.sort .tt-item:nth-child(6) { animation-delay: 0.18s; }
.sort .tt-item:nth-child(7) { animation-delay: 0.21s; }
.sort .tt-item:nth-child(8) { animation-delay: 0.24s; }
.sort .tt-item:nth-child(9) { animation-delay: 0.27s; }
.sort .tt-item:nth-child(10) { animation-delay: 0.30s; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .tt-item-inner {
        padding: 14px 18px;
        gap: 10px;
    }
    .tt-input-area { padding: 18px; }
    .tt-input-row { flex-direction: column; gap: 10px; }
    .tt-add-btn { width: 100%; justify-content: center; }
    .tt-item-drag { display: none; }
    .tt-item-actions { opacity: 1; }
    .tt-item-text { font-size: 14px !important; }
    .tt-empty { padding: 40px 18px; }
}

/* ---- Dashboard Compact Variant ---- */
.card .tt-item-inner {
    padding: 12px 0;
    gap: 10px;
    min-height: auto;
}
.card .tt-item-text {
    font-size: 13px !important;
}
.card .tt-item-date {
    font-size: 11px;
}
.card .tt-action-btn {
    width: 28px;
    height: 28px;
    font-size: 11px;
}
.card .tt-checkbox-wrap {
    width: 22px;
    height: 22px;
}
.card .tt-checkmark {
    width: 20px;
    height: 20px;
    border-radius: 6px;
}
.card .tt-checkmark::after {
    width: 5px;
    height: 9px;
}
