:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --primary-color: #6366f1;
    /* Indigo */
    --accent-color: #ec4899;
    /* Pink */
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    --font-main: 'Outfit', sans-serif;
}

.dependency-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

body.light-mode {
    --bg-color: #ffffff;
    --text-color: #202124;
    --glass-bg: #f8f9fa;
    /* Google's light grey */
    --glass-border: #dadce0;
    --glass-shadow: 0 1px 3px rgba(60, 64, 67, 0.3);
}

body.light-mode .modal {
    background: rgba(255, 255, 255, 0.6);
}

body.light-mode .glass-panel {
    background: #ffffff;
    border: 1px solid #dadce0;
    box-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
}

body.light-mode .input-field {
    background: #ffffff;
    border: 1px solid #dadce0;
    color: #202124;
}

body.light-mode .card {
    background: #ffffff;
    border: 1px solid #dadce0;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3);
}

body.light-mode .card:hover {
    box-shadow: 0 4px 6px rgba(60, 64, 67, 0.3);
    border-color: #dadce0;
}

body.light-mode .header-col {
    color: #5f6368;
}

body.light-mode .swimlane-title {
    color: #5f6368;
}

body.light-mode .subtask-item {
    background: #f1f3f4;
    color: #202124;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background Blobs */
/* Background Blobs Removed */
/* .background-blobs styles were removed here */

/* Layout */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    padding-top: 0.5rem;
    /* Reduced top padding */
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    margin-top: 0;
}

h1 {
    font-weight: 600;
    font-size: 2.5rem;
    margin: 0;
    color: var(--text-color);
}

/* Board Structure */
.kanban-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.header-col {
    font-size: 1.25rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
}

/* Simple Tasks (No Subtasks) */
.simple-tasks-area {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    /* Maintain structure even for empty right side */
    gap: 2rem;
    margin-bottom: 2rem;
}

.simple-task-wrapper {
    /* Only occupies left column */
    grid-column: 1 / 2;
}

/* Swimlanes */
.swimlane {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2rem;
    padding: 1.5rem 0;
    border-top: 1px solid var(--glass-border);
    position: relative;
    cursor: grab;
    /* Indicate draggable */
    transition: background 0.2s;
}

.swimlane:active {
    cursor: grabbing;
}

.swimlane.dragging {
    opacity: 0.5;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.2);
}

.swimlane-title {
    position: absolute;
    top: 5px;
    left: 0;
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    z-index: 10;
}

.do-now-zone,
.do-next-zone,
.do-later-zone {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 100px;
    /* Ensure drop target exists even when empty */
    height: 100%;
}

/* Cards */
.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: var(--glass-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.2);
}

@keyframes fadeInSlideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeInSlideUp 0.3s ease-out forwards;
}

.swimlane {
    animation: fadeInSlideUp 0.4s ease-out forwards;
}

.card:hover .btn-delete,
.card:hover .btn-add,
.card:hover .btn-link,
.card:hover .btn-done {
    opacity: 1;
}

/* Linking Mode */
body.linking-mode .card {
    cursor: crosshair;
    border-color: var(--primary-color);
    animation: pulse-border 1.5s infinite;
}

body.linking-mode .card:hover {
    background: rgba(99, 102, 241, 0.2);
    /* Highlight potential target */
}

@keyframes pulse-border {
    0% {
        border-color: var(--glass-border);
    }

    50% {
        border-color: var(--primary-color);
    }

    100% {
        border-color: var(--glass-border);
    }
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--primary-color);
    padding: 1rem 2rem;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 200;
    transition: opacity 0.3s, transform 0.3s;
    font-weight: 600;
}

.toast.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 20px);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
    /* Flattened gradient to single color or remove entirely if "burst" */
    /* If user wants NO burst, maybe just a solid stripe or removed? Let's keep a subtle stripe. */
}

.card-title {
    margin: 0 0 0.5rem 1.6rem;
    /* Space for star */
    font-weight: 400;
    font-size: 1.1rem;
}

.card-desc {
    font-size: 0.85rem;
    color: #94a3b8;
    margin: 0.5rem 0.5rem 0.5rem 1.6rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-due-date {
    font-size: 0.75rem;
    color: var(--accent-color);
    margin: 0.25rem 0.5rem 0.25rem 1.6rem;
    font-weight: 600;
}

.badge {
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 800;
    margin-left: 5px;
    vertical-align: middle;
}

.overdue-badge {
    background: #ef4444;
    color: white;
}

.due-soon-badge {
    background: #fbbf24;
    color: #0f172a;
}

.card.overdue {
    border-left: 4px solid #ef4444 !important;
}

.card.due-soon {
    border-left: 4px solid #fbbf24 !important;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.5rem 0.5rem 0.5rem 1.6rem;
}

.tag {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-color);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

body.light-mode .tag {
    background: #e0e7ff;
    color: #4338ca;
}


.card-parent-ref {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-left: 0.5rem;
}

.card-dependency-text {
    font-size: 0.7rem;
    color: #64748b;
    /* Slate-500 */
    font-style: italic;
    margin-top: 0.25rem;
    margin-left: 0.5rem;
    display: block;
    opacity: 0.7;
}

.card-controls {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    /* Space between buttons */
    margin-top: 0.5rem;
}

.btn-delete {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.btn-add {
    background: none;
    border: none;
    color: #34d399;
    /* Emerald/Green */
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.2s;
    font-weight: 600;
}

.btn-link {
    background: none;
    border: none;
    color: #fbbf24;
    /* Amber/Yellow */
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.2s;
    font-weight: 600;
}

.btn-done {
    background: none;
    border: none;
    color: #38bdf8;
    /* Sky Blue */
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.2s;
    font-weight: 600;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.3s;
}

.modal.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.glass-panel {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 16px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.input-field {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    padding: 0.75rem;
    border-radius: 8px;
    color: white;
    font-family: inherit;
    margin-bottom: 1rem;
    box-sizing: border-box;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s;
}

.btn-primary:hover {
    filter: brightness(1.2);
}

.btn-secondary {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
}

.btn-text {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    margin-right: 1rem;
}

/* Starred Task */
.starred {
    border-color: #fbbf24 !important;
    /* Amber */
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.4) !important;
}

.btn-star-corner {
    position: absolute;
    top: 15px;
    left: 10px;
    background: none;
    border: none;
    color: #fbbf24;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    opacity: 0.2;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 5;
}

.btn-star-corner:hover {
    opacity: 1;
    transform: scale(1.2);
}

.starred .btn-star-corner {
    opacity: 1;
    transform: scale(1.1);
}

/* Subtasks in Modal */
.subtask-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.btn-add-header {
    background: none;
    border: 1px solid var(--glass-border);
    color: var(--primary-color);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;

}

.btn-add-header:hover {
    opacity: 1;
    background: rgba(99, 102, 241, 0.2);
    transform: scale(1.1);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border-right: 1px solid var(--glass-border);
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.sidebar-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.5rem 1rem 1.5rem;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-color);
}

.board-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1rem;
}

.board-item {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    color: #94a3b8;
    text-align: left;
    background: transparent;
    border: none;
    font-size: 1rem;
    width: 100%;
}

.board-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
}

.board-item.active {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

/* Helper Buttons */
.btn-icon {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    margin-right: 1rem;
    line-height: 1;
}

.full-width {
    width: calc(100% - 2rem);
    margin: 1rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    header>div:last-child {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }

    #searchInput {
        width: 100% !important;
    }

    .kanban-header {
        display: none;
        /* Hide header row on mobile as it won't align with stacked columns */
    }

    .simple-tasks-area,
    .swimlane {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    .simple-task-wrapper {
        grid-column: 1 / -1;
    }

    .swimlane-title {
        position: static;
        margin-bottom: 0.5rem;
        background: var(--glass-bg);
        padding: 0.5rem;
        border-radius: 8px;
    }

    /* Column labels for mobile */
    .do-now-zone::before {
        content: "Do Now";
        display: block;
        font-weight: 600;
        font-size: 0.8rem;
        color: #94a3b8;
        margin-bottom: 0.5rem;
        border-bottom: 1px solid var(--glass-border);
    }

    .do-next-zone::before {
        content: "Do Next";
        display: block;
        font-weight: 600;
        font-size: 0.8rem;
        color: #94a3b8;
        margin-bottom: 0.5rem;
        border-bottom: 1px solid var(--glass-border);
    }

    .do-later-zone::before {
        content: "Do Later";
        display: block;
        font-weight: 600;
        font-size: 0.8rem;
        color: #94a3b8;
        margin-bottom: 0.5rem;
        border-bottom: 1px solid var(--glass-border);
    }

    .modal-content {
        width: 95% !important;
        padding: 1rem !important;
    }

    .sidebar {
        width: 85%;
    }
}