/* bkraft.org — adapted from GrieveRight */

:root {
    --bk-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --bk-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --bk-transition: 0.2s ease;
    --bk-gradient-primary: linear-gradient(135deg, #1a2744 0%, #2c4a7c 100%);
    --bk-radius: 0.5rem;
}

[data-bs-theme="dark"] {
    --bk-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --bk-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --bk-gradient-primary: linear-gradient(135deg, #0f1a2e 0%, #1a2d4d 100%);
}

/* Navbar */
.navbar.bg-dark {
    background: var(--bk-gradient-primary) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Cards */
.card {
    box-shadow: var(--bk-shadow-sm);
    border-radius: var(--bk-radius);
    transition: box-shadow var(--bk-transition);
}

.card:hover {
    box-shadow: var(--bk-shadow-md);
}

/* Stat cards */
.card.border-success .card-body {
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.04) 0%, rgba(25, 135, 84, 0.1) 100%);
    border-radius: var(--bk-radius);
}

/* Page headers */
.page-header {
    padding-bottom: 0.75rem;
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(90deg, var(--bs-primary) 0%, transparent 60%) 1;
    margin-bottom: 1rem;
}

/* Buttons */
.btn {
    transition: all var(--bk-transition);
}

.btn-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
    border-color: #0b5ed7;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #3d8bfd 0%, #0d6efd 100%);
    border-color: #0d6efd;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
}

/* Dark mode body */
[data-bs-theme="dark"] body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    background-attachment: fixed;
}

/* Login */
.login-container {
    max-width: 420px;
    margin: 80px auto;
}

/* ============================================================
   TASK ITEMS — Swipeable (mobile) + Hover (desktop)
   ============================================================ */
.task-item-wrapper {
    position: relative;
    overflow: visible;
    border-bottom: 1px solid var(--bs-border-color);
}

/* Only clip overflow during swipe */
.task-item-wrapper.swiping-left,
.task-item-wrapper.swiping-right {
    overflow: hidden;
}

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

.task-content {
    position: relative;
    z-index: 1;
    background-color: var(--bs-body-bg);
    transition: background-color var(--bk-transition);
}

.task-content:hover {
    background-color: rgba(13, 110, 253, 0.04) !important;
}

[data-bs-theme="dark"] .task-content:hover {
    background-color: rgba(13, 110, 253, 0.08) !important;
}

/* Swipe action backgrounds — each covers full width, stacked behind content */
.task-action-left,
.task-action-right {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    display: none;
    align-items: center;
    font-size: 1.5rem;
    color: #fff;
    padding: 0 1.25rem;
}

.task-action-left {
    background-color: var(--bs-success);
    justify-content: flex-start;
    z-index: 0;
}

.task-action-right {
    background-color: var(--bs-danger);
    justify-content: flex-end;
    z-index: 0;
}

/* Swipe backgrounds shown dynamically via JS class */
.task-item-wrapper.swiping-right .task-action-left {
    display: flex;
}

.task-item-wrapper.swiping-left .task-action-right {
    display: flex;
}

/* Hide delete button on touch (use swipe instead) */
.touch-device .task-delete {
    display: none !important;
}

/* Show delete button on desktop hover */
.task-delete {
    opacity: 0;
    transition: opacity var(--bk-transition);
}

.task-item-wrapper:hover .task-delete {
    opacity: 1;
}

/* Priority left border */
.task-item-wrapper.priority-urgent .task-content { border-left: 4px solid var(--bs-danger); }
.task-item-wrapper.priority-high .task-content { border-left: 4px solid var(--bs-warning); }
.task-item-wrapper.priority-normal .task-content { border-left: 4px solid transparent; }
.task-item-wrapper.priority-low .task-content { border-left: 4px solid transparent; opacity: 0.7; }

/* Drag handle */
.drag-handle {
    cursor: grab;
    color: var(--bs-secondary-color);
    padding: 0.25rem;
    touch-action: none;
    min-width: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.drag-handle:active { cursor: grabbing; }

/* Dragging state */
.task-item-wrapper.sortable-ghost {
    opacity: 0.4;
    background-color: var(--bs-primary-bg-subtle);
}

.task-item-wrapper.sortable-drag {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Three-dot menu */
.task-actions .btn { padding: 0.15rem 0.35rem; }
.task-actions .dropdown-menu { z-index: 1050; }

/* When dropdown is open, lift the entire task item above siblings */
.task-item-wrapper:has(.dropdown-menu.show) {
    z-index: 100;
}

.task-item-wrapper:has(.dropdown-menu.show) .task-content {
    z-index: 100;
}

/* Card needs visible overflow for dropdowns */
.card { overflow: visible; }
.list-group-flush { overflow: visible; }

/* Prevent text overflow */
.min-width-0 { min-width: 0; }
.task-text { word-break: break-word; }
.task-text-area { cursor: pointer; }

.task-check {
    cursor: pointer;
    width: 1.25em;
    height: 1.25em;
}

/* Completing animation */
.task-item-wrapper.completing .task-content {
    background-color: var(--bs-success-bg-subtle) !important;
    transition: background-color 0.3s ease;
}

/* Removal animation */
@keyframes taskSlideOut {
    0% { max-height: 80px; opacity: 1; }
    50% { opacity: 0; }
    100% { max-height: 0; opacity: 0; padding: 0; margin: 0; border: 0; overflow: hidden; }
}

.task-item-wrapper.removing {
    animation: taskSlideOut 300ms ease forwards;
}

/* Flash animations */
@keyframes alertSlideIn {
    from { transform: translateY(-1rem); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.alert-dismissible {
    animation: alertSlideIn 0.3s ease;
}

/* Sync button spin */
@keyframes syncSpin {
    to { transform: rotate(360deg); }
}
.spin-animation {
    animation: syncSpin 1s linear infinite;
}

/* Mobile */
html, body {
    overflow-x: hidden;
}

@media (max-width: 767.98px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    textarea,
    select,
    .form-control,
    .form-select {
        font-size: 16px !important;
    }

    .page-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem;
    }

    .card-body {
        padding: 0.75rem;
    }
}
