/* ==========================================================================
   Kanban Board Layout
   ========================================================================== */
.task-panel {
    width: min(1120px, 100%);
    margin: 0 auto;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    min-height: 320px;
    /* Establishes 3D space for the card hover effects */
    perspective: 1200px; 
}

/* ==========================================================================
   Kanban Columns (Lanes)
   ========================================================================== */
.kanban-column {
    display: flex;
    flex-direction: column;
    min-width: 0; /* Prevents flex blowout */
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255, 250, 240, 0.8), rgba(255, 255, 251, 0.5));
    box-shadow: 0 16px 40px rgba(35, 48, 47, 0.06);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}

/* Lift and highlight the column when a card is dragged over it */
.kanban-column:has(.drag-over) {
    transform: translateY(-4px);
    background: linear-gradient(180deg, rgba(240, 251, 247, 0.95), rgba(255, 255, 251, 0.8));
    border-color: rgba(15, 124, 114, 0.3);
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.kanban-lane-title {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-start;
}

.kanban-lane-title h2 {
    margin: 0;
    font-family: var(--font-heading, "Fraunces", serif);
    font-size: 1.35rem;
    color: var(--ink, #111);
    letter-spacing: -0.02em;
}

.lane-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, var(--accent, #0f7c72), var(--accent-dark, #09524d));
    box-shadow: 0 4px 12px rgba(15, 124, 114, 0.2);
}

.kanban-count {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    color: #fff;
    background: var(--ink, #111);
    font-size: 0.85rem;
    font-weight: 800;
}

/* ==========================================================================
   Drop Zones & Empty States
   ========================================================================== */
.kanban-task-list {
    flex: 1; /* Pushes content down, fills column */
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 180px;
    padding: 8px 4px; /* Padding for hover shadows */
    margin: 0 -4px;
    list-style: none;
    border: 2px dashed transparent;
    border-radius: 18px;
    transition: all 0.2s ease;
}

/* Visual cue when a column is completely empty */
.kanban-task-list:empty::before {
    content: 'Drop tasks here';
    display: grid;
    place-items: center;
    height: 100%;
    min-height: 120px;
    border: 2px dashed rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    color: var(--muted, #666);
    font-size: 0.9rem;
    font-weight: 700;
    opacity: 0.7;
}

.kanban-task-list.drag-over {
    border-color: var(--accent, #0f7c72);
    background: rgba(15, 124, 114, 0.05);
}

/* ==========================================================================
   Task Cards (Physical / 3D Feel)
   ========================================================================== */
.kanban-column .task-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    background: linear-gradient(145deg, #fffef9, #f0fbf7);
    /* Creates a pseudo-3D lip at the bottom of the card */
    box-shadow: 
        0 14px 24px rgba(35, 48, 47, 0.08), 
        0 4px 0 rgba(9, 82, 77, 0.05); 
    cursor: grab;
    /* Cubic-bezier for a springy, physical transition */
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), 
                box-shadow 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-style: preserve-3d;
}

.kanban-column .task-item:hover {
    /* Subtle 3D tilt towards the user */
    transform: translateY(-6px) rotateX(3deg) rotateY(-2deg);
    box-shadow: 
        0 24px 38px rgba(35, 48, 47, 0.12), 
        0 8px 0 rgba(9, 82, 77, 0.08); 
}

/* Active/Dragging state: Compress the card like it's being squeezed */
.kanban-column .task-item:active,
.kanban-column .task-item.dragging {
    cursor: grabbing;
    transform: translateY(-2px) scale(0.98);
    box-shadow: 
        0 8px 16px rgba(35, 48, 47, 0.1), 
        0 2px 0 rgba(9, 82, 77, 0.05);
    opacity: 0.85;
    outline: 2px dashed rgba(15, 124, 114, 0.5);
    outline-offset: 4px;
}

/* ==========================================================================
   Task Card Internals
   ========================================================================== */
.task-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.task-card-top h3 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.4;
    color: var(--ink, #111);
}

.task-mini-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

/* Chips for tags, dates, and assignees */
.mini-chip, .icon-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: max-content;
    max-width: 100%;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(15, 124, 114, 0.08);
    color: var(--accent-dark, #09524d);
    font-size: 0.78rem;
    font-weight: 800;
    text-decoration: none;
    overflow-wrap: anywhere;
    transition: background 0.2s ease;
}

.mini-chip:hover, .icon-chip:hover {
    background: rgba(15, 124, 114, 0.15);
}

/* Status Select inside Task */
.kanban-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 4px;
    padding-top: 14px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.status-select {
    flex: 1;
    max-width: 130px;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid rgba(15, 124, 114, 0.2);
    border-radius: 999px;
    color: var(--accent-dark, #09524d);
    background: #d9efea;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.status-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(15, 124, 114, 0.2);
}

/* Action Buttons */
.task-detail-link, .delete-button {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 50%;
    color: #fff;
    background: var(--ink, #111);
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s ease, background 0.2s ease;
}

.task-detail-link:hover, .delete-button:hover {
    transform: scale(1.1);
}

.delete-button {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.delete-button:hover {
    background: #dc3545;
    color: #fff;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 999px;
    color: var(--accent-dark, #09524d);
    background: #edf7f4;
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ==========================================================================
   Responsive Utilities
   ========================================================================== */
@media (max-width: 900px) {
    .kanban-board {
        grid-template-columns: 1fr;
        gap: 20px;
        perspective: none; /* Disable 3D on mobile for performance */
    }

    .kanban-column .task-item:hover {
        /* Simpler hover state for touch devices */
        transform: translateY(-4px);
    }
}

/* ==========================================================================
   Running Task Watch + Start Alerts
   ========================================================================== */
.task-watch-corner {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 40;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: min(260px, calc(100vw - 36px));
    padding: 10px 14px;
    border: 1px solid rgba(15, 124, 114, 0.18);
    border-radius: 999px;
    color: var(--accent-dark, #09524d);
    background: rgba(255, 255, 251, 0.88);
    box-shadow: 0 16px 40px rgba(35, 48, 47, 0.12);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.task-watch-icon {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, var(--accent, #0f7c72), var(--accent-dark, #09524d));
    font-weight: 900;
}

.task-watch-corner.has-active-task .task-watch-icon,
.status-badge-progress::before {
    animation: task-spin 0.9s linear infinite;
}

.task-watch-body {
    display: grid;
    line-height: 1.1;
}

.task-watch-time {
    font-size: 0.95rem;
    font-weight: 900;
}

.task-watch-status {
    overflow: hidden;
    max-width: 170px;
    font-size: 0.72rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-badge-progress {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #0c615b;
    background: rgba(53, 199, 184, 0.16);
}

.status-badge-progress::before {
    content: "↻";
    display: inline-block;
    font-size: 0.85rem;
    line-height: 1;
}

.task-start-alert {
    position: fixed;
    top: 74px;
    right: 18px;
    z-index: 41;
    max-width: min(320px, calc(100vw - 36px));
    padding: 12px 16px;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(135deg, var(--accent, #0f7c72), var(--accent-dark, #09524d));
    box-shadow: 0 18px 40px rgba(15, 124, 114, 0.24);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.task-start-alert.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@keyframes task-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .task-watch-corner.has-active-task .task-watch-icon,
    .status-badge-progress::before {
        animation: none;
    }
}

@media (max-width: 700px) {
    .task-watch-corner,
    .task-start-alert {
        top: auto;
        right: 12px;
        bottom: 12px;
    }

    .task-start-alert {
        bottom: 70px;
    }
}