@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600&family=Inter:wght@300;400;500;600&display=swap');

:root {
    --bg-body: #0a0a0a;
    --bg-gradient: radial-gradient(circle at top right, #1a1a2e, #0a0a0a);

    /* Glassmorphism Layers */
    --glass-surface: rgba(30, 30, 30, 0.4);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.03);

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #666677;

    /* Accents */
    --accent: #7c4dff;
    /* Deep Purple */
    --accent-glow: rgba(124, 77, 255, 0.4);
    --accent-gradient: linear-gradient(135deg, #7c4dff, #448aff);

    /* Status Colors */
    --danger: #ff5252;
    --priority-high: #ff4757;
    --priority-med: #ffa502;
    --priority-low: #2ed573;

    --type-complex: #5352ed;
    --type-simple: #1e90ff;

    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);

    --radius-md: 12px;
    --radius-lg: 16px;
}

* {
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg-body);
    background-image: var(--bg-gradient);
    color: var(--text-primary);
    margin: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

h1,
h2,
h3 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

/* Header */
header {
    padding: 20px 30px;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

header .brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

h1 {
    margin: 0;
    font-size: 1.8rem;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #fff, #aaa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* Search Bar */
.search-container {
    position: relative;
}

.search-input {
    background: var(--glass-surface);
    border: 1px solid var(--glass-border);
    padding: 8px 15px 8px 35px;
    border-radius: 20px;
    color: white;
    font-size: 0.9rem;
    width: 200px;
    transition: all 0.3s ease;
}

.search-input:focus {
    width: 280px;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
    outline: none;
    box-shadow: 0 0 0 2px rgba(124, 77, 255, 0.2);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: 0.8rem;
}

/* Add Button */
button.add-btn {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px var(--accent-glow);
    display: flex;
    align-items: center;
    gap: 8px;
}

button.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--accent-glow);
}

/* Board Layout */
.board {
    display: flex;
    flex: 1;
    padding: 30px;
    gap: 25px;
    overflow-x: auto;
}

.column {
    flex: 1;
    min-width: 320px;
    background: var(--glass-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.3s;
}

.column:hover {
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 255, 255, 0.1);
}

.column-header {
    padding: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    letter-spacing: 0.5px;
}

.count-badge {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.task-list {
    flex: 1;
    padding: 0 15px 15px 15px;
    overflow-y: auto;
    transition: background 0.2s;
    /* Custom Scrollbar spacing */
}

.task-list.drag-over {
    background: rgba(124, 77, 255, 0.05);
    border-radius: var(--radius-md);
}

/* Cards */
.card {
    background: #252530;
    /* Solid enough to hide content behind */
    background: linear-gradient(145deg, #2a2a35, #22222a);
    padding: 18px;
    border-radius: var(--radius-md);
    margin-bottom: 15px;
    cursor: grab;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-left: 4px solid transparent;
    /* Priority Indicator */
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 12px 24px -5px rgba(0, 0, 0, 0.4);
    border-top-color: rgba(255, 255, 255, 0.1);
}

.card.dragging {
    opacity: 0.4;
    transform: rotate(2deg);
    cursor: grabbing;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.card-title {
    font-weight: 600;
    font-size: 1.05rem;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* New: Due Date Styling */
.card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.due-date {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
}

.due-date.overdue {
    color: var(--danger);
    background: rgba(255, 82, 82, 0.1);
}

.tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    font-size: 0.65rem;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.tag.p-high {
    background: rgba(255, 71, 87, 0.2);
    color: var(--priority-high);
}

.tag.p-med {
    background: rgba(255, 165, 2, 0.2);
    color: var(--priority-med);
}

.tag.p-low {
    background: rgba(46, 213, 115, 0.2);
    color: var(--priority-low);
}

.tag.t-complex {
    background: rgba(83, 82, 237, 0.2);
    color: var(--type-complex);
}

.tag.t-simple {
    background: rgba(30, 144, 255, 0.2);
    color: var(--type-simple);
}

/* Card Actions */
.actions {
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}

.card:hover .actions {
    opacity: 1;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.icon-btn.delete:hover {
    color: var(--danger);
    background: rgba(255, 82, 82, 0.1);
}

/* Progress Bar */
.progress-wrapper {
    margin-top: 12px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.progress-track {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Subtasks (detail view) */
.subtasks-container {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid var(--glass-border);
}

.subtask-item {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    padding: 4px 0;
    transition: color 0.2s;
}

.subtask-item:hover {
    color: var(--text-primary);
}

.subtask-item input[type="checkbox"] {
    appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid var(--text-muted);
    border-radius: 4px;
    margin-right: 10px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.subtask-item input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.subtask-item input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 10px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.subtask-item.completed span {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background: #1e1e24;
    /* Dark solid fallback */
    background: linear-gradient(145deg, #25252f, #1e1e24);
    padding: 30px;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

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

.modal h2 {
    margin-top: 0;
    font-family: 'Outfit', sans-serif;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.5rem;
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.3);
    outline: none;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 30px;
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.btn-save {
    background: var(--accent-gradient);
    border: none;
    color: white;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--accent-glow);
    transition: all 0.2s;
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--accent-glow);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {

    /* Header Stack */
    header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .search-container {
        flex: 1;
        margin-right: 10px;
    }

    .search-input {
        width: 100%;
        /* Full width on mobile */
    }

    .search-input:focus {
        width: 100%;
    }

    /* Board Stack */
    .board {
        flex-direction: column;
        padding: 15px;
        overflow-x: hidden;
        /* No horizontal scroll */
        height: auto;
        /* Allow full height scrolling */
    }

    body {
        overflow-y: auto;
        /* Enable page scroll */
    }

    .column {
        min-width: 100%;
        /* Full width columns */
        height: auto;
        min-height: 200px;
        /* Ensure drop target exists */
    }

    .task-list {
        min-height: 100px;
        /* Ensure drop zone */
    }

    /* Modal */
    .modal {
        width: 95%;
        padding: 20px;
    }
}