/* ============================================================
   FlowBoard — Task Manager  |  style.css
   Aesthetic: Dark-default, glassmorphism cards, neon accents
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
    /* Dark theme (default) */
    --bg-base: #0d0f14;
    --bg-surface: #14171f;
    --bg-column: #181c27;
    --bg-card: #1e2230;
    --bg-card-hover: #252b3d;
    --bg-modal: #1a1e2e;
    --bg-input: #111420;
    --bg-overlay: rgba(5, 7, 15, 0.78);

    --border: rgba(255, 255, 255, 0.06);
    --border-focus: rgba(99, 102, 241, 0.7);

    --text-primary: #eef0f8;
    --text-secondary: #8b90a8;
    --text-muted: #555a75;

    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.25);
    --accent-light: #818cf8;

    --col-todo: #6366f1;
    --col-progress: #f59e0b;
    --col-done: #10b981;

    --priority-high: #ef4444;
    --priority-medium: #f59e0b;
    --priority-low: #22c55e;

    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 0 3px var(--accent-glow);

    --radius-card: 14px;
    --radius-modal: 20px;
    --radius-btn: 10px;
    --radius-badge: 20px;

    --font-main: 'Poppins', sans-serif;
    --font-mono: 'Space Mono', monospace;

    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light theme */
[data-theme="light"] {
    --bg-base: #f0f2f8;
    --bg-surface: #e6e9f4;
    --bg-column: #eaecf5;
    --bg-card: #ffffff;
    --bg-card-hover: #f5f6fd;
    --bg-modal: #ffffff;
    --bg-input: #f0f2f8;
    --bg-overlay: rgba(20, 25, 60, 0.5);

    --border: rgba(0, 0, 0, 0.08);
    --border-focus: rgba(99, 102, 241, 0.5);

    --text-primary: #1a1d2e;
    --text-secondary: #5c617a;
    --text-muted: #9094ad;

    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.15);
    --accent-light: #4f46e5;

    --shadow-card: 0 2px 16px rgba(0, 0, 0, 0.08);
    --shadow-modal: 0 16px 48px rgba(0, 0, 0, 0.18);
}

/* ---- Reset ---- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
    overflow-x: hidden;
}

/* Subtle grid background texture */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(16, 185, 129, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 28px;
    height: 68px;
    flex-wrap: wrap;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    user-select: none;
}

.logo-icon {
    font-size: 24px;
    color: var(--accent);
    filter: drop-shadow(0 0 6px var(--accent-glow));
    animation: pulse-logo 3s ease-in-out infinite;
}

@keyframes pulse-logo {

    0%,
    100% {
        filter: drop-shadow(0 0 4px var(--accent-glow));
    }

    50% {
        filter: drop-shadow(0 0 12px var(--accent));
    }
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 300;
    letter-spacing: -0.3px;
    color: var(--text-primary);
}

.logo-text strong {
    font-weight: 700;
    color: var(--accent-light);
}

/* Analytics bar */
.analytics-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-column);
    border: 1px solid var(--border);
    border-radius: 40px;
    padding: 6px 16px;
}

.stat {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-num {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-light);
    margin-right: 3px;
}

.stat-divider {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Search */
.search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    font-size: 1.1rem;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.85rem;
    padding: 8px 14px 8px 36px;
    width: 200px;
    transition: border-color var(--transition), box-shadow var(--transition), width var(--transition);
    outline: none;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    border-color: var(--border-focus);
    box-shadow: var(--shadow-glow);
    width: 240px;
}

/* Filter */
.filter-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.82rem;
    padding: 8px 12px;
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition);
}

.filter-select:focus {
    border-color: var(--border-focus);
}

.filter-select option {
    background: var(--bg-modal);
}

/* Theme Toggle */
.theme-toggle {
    background: var(--bg-column);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--accent);
    transform: rotate(20deg) scale(1.08);
    box-shadow: 0 0 12px var(--accent-glow);
}

/* ============================================================
   BOARD WRAPPER
   ============================================================ */
.board-wrapper {
    position: relative;
    z-index: 1;
    padding: 32px 28px 48px;
    min-height: calc(100vh - 68px);
}

.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 1280px;
    margin: 0 auto;
    align-items: start;
}

/* ============================================================
   COLUMN
   ============================================================ */
.column {
    background: var(--bg-column);
    border: 1px solid var(--border);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
    transition: box-shadow var(--transition);
    min-height: 200px;
}

.column.drag-over {
    box-shadow: 0 0 0 2px var(--accent), 0 8px 40px var(--accent-glow);
}

/* Column Header */
.col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--border);
    gap: 8px;
}

.col-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.col-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-todo {
    background: var(--col-todo);
    box-shadow: 0 0 8px var(--col-todo);
}

.dot-inprogress {
    background: var(--col-progress);
    box-shadow: 0 0 8px var(--col-progress);
}

.dot-completed {
    background: var(--col-done);
    box-shadow: 0 0 8px var(--col-done);
}

.col-title {
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.col-badge {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: var(--radius-badge);
}

.add-btn {
    background: var(--bg-card);
    border: 1px dashed var(--border);
    color: var(--text-muted);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
    flex-shrink: 0;
    line-height: 1;
}

.add-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    transform: scale(1.1);
}

/* Task List */
.task-list {
    padding: 14px 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 100px;
}

.task-list.drag-over-list {
    background: rgba(99, 102, 241, 0.04);
    border-radius: 0 0 20px 20px;
}

/* ============================================================
   TASK CARD
   ============================================================ */
.task-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 16px;
    cursor: grab;
    box-shadow: var(--shadow-card);
    transition:
        transform var(--transition),
        box-shadow var(--transition),
        background var(--transition),
        opacity var(--transition);
    position: relative;
    overflow: hidden;
    animation: card-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    user-select: none;
}

@keyframes card-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.task-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px var(--border-focus);
}

.task-card:active {
    cursor: grabbing;
}

.task-card.dragging {
    opacity: 0.4;
    transform: scale(0.97);
    cursor: grabbing;
}

.task-card.drag-ghost {
    opacity: 0.7;
    transform: rotate(2deg) scale(1.02);
    box-shadow: 0 16px 48px rgba(99, 102, 241, 0.35);
}

/* Priority stripe */
.task-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 14px 0 0 14px;
    transition: width var(--transition);
}

.task-card[data-priority="high"]::before {
    background: var(--priority-high);
}

.task-card[data-priority="medium"]::before {
    background: var(--priority-medium);
}

.task-card[data-priority="low"]::before {
    background: var(--priority-low);
}

.task-card:hover::before {
    width: 6px;
}

/* Card top row */
.card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.card-title {
    font-size: 0.93rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    word-break: break-word;
    flex: 1;
}

.card-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition);
    flex-shrink: 0;
}

.task-card:hover .card-actions {
    opacity: 1;
}

.card-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 7px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background var(--transition), color var(--transition);
    color: var(--text-muted);
}

.card-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.card-btn.delete:hover {
    background: var(--priority-high);
    border-color: var(--priority-high);
}

/* Card description */
.card-desc {
    font-size: 0.80rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 12px;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Card footer */
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.priority-badge {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: var(--radius-badge);
    border: 1px solid;
}

.priority-badge.high {
    color: var(--priority-high);
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
}

.priority-badge.medium {
    color: var(--priority-medium);
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.25);
}

.priority-badge.low {
    color: var(--priority-low);
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.25);
}

.card-due {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-due.overdue {
    color: var(--priority-high);
}

.card-due.soon {
    color: var(--priority-medium);
}

/* Empty column state */
.empty-state {
    text-align: center;
    padding: 28px 16px;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.7;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    animation: fade-in 0.3s ease;
}

.empty-state.visible {
    display: flex;
}

.empty-icon {
    font-size: 2rem;
    opacity: 0.3;
}

/* No results */
.no-results {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.82rem;
    display: none;
}

.no-results.visible {
    display: block;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: var(--radius-modal);
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-modal);
    transform: translateY(20px) scale(0.97);
    transition: transform var(--transition);
    overflow: hidden;
}

.modal-overlay.open .modal {
    transform: translateY(0) scale(1);
}

.modal-sm {
    max-width: 380px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 24px 18px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: background var(--transition), color var(--transition);
}

.modal-close:hover {
    background: var(--priority-high);
    color: #fff;
    border-color: var(--priority-high);
}

.modal-body {
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.modal-footer {
    padding: 16px 24px 22px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid var(--border);
}

/* Form Elements */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-label {
    font-size: 0.80rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.required {
    color: var(--priority-high);
}

.form-input,
.form-textarea,
.form-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.9rem;
    padding: 11px 14px;
    width: 100%;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: var(--border-focus);
    box-shadow: var(--shadow-glow);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-select {
    cursor: pointer;
}

.form-select option {
    background: var(--bg-modal);
}

/* date input styling trick */
input[type="date"] {
    color-scheme: dark;
}

[data-theme="light"] input[type="date"] {
    color-scheme: light;
}

/* Buttons */
.btn {
    font-family: var(--font-main);
    font-size: 0.88rem;
    font-weight: 600;
    padding: 10px 22px;
    border-radius: var(--radius-btn);
    border: none;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
    letter-spacing: 0.2px;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-primary:hover {
    background: var(--accent-light);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.45);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--priority-high);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.delete-msg {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ============================================================
   DRAG PLACEHOLDER
   ============================================================ */
.drag-placeholder {
    border: 2px dashed var(--accent);
    border-radius: var(--radius-card);
    background: var(--accent-glow);
    min-height: 80px;
    animation: placeholder-pulse 1s ease-in-out infinite;
}

@keyframes placeholder-pulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* ============================================================
   TOAST NOTIFICATION
   ============================================================ */
.toast-container {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 18px;
    font-size: 0.84rem;
    color: var(--text-primary);
    box-shadow: var(--shadow-modal);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 220px;
    animation: toast-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    pointer-events: all;
}

.toast.toast-out {
    animation: toast-out 0.25s ease forwards;
}

.toast-icon {
    font-size: 1rem;
}

.toast-text {
    flex: 1;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateX(20px) scale(0.95);
    }
}

/* ============================================================
   UTILITY
   ============================================================ */
@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.hidden {
    display: none !important;
}

/* ============================================================
   SCROLLBAR (webkit)
   ============================================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================================
   RESPONSIVE — TABLET (≤900px)
   ============================================================ */
@media (max-width: 900px) {
    .header {
        height: auto;
        padding: 12px 18px;
        gap: 12px;
    }

    .header-left,
    .header-right {
        flex-wrap: wrap;
        gap: 10px;
    }

    .analytics-bar {
        display: none;
    }

    .search-input {
        width: 160px;
    }

    .search-input:focus {
        width: 180px;
    }

    .board-wrapper {
        padding: 20px 14px 36px;
    }

    .board {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
    }
}

/* ============================================================
   RESPONSIVE — MOBILE (≤640px)
   ============================================================ */
@media (max-width: 640px) {
    .header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 14px;
    }

    .header-left {
        justify-content: space-between;
    }

    .header-right {
        justify-content: space-between;
        width: 100%;
    }

    .search-input {
        width: 100%;
    }

    .search-input:focus {
        width: 100%;
    }

    .search-wrap {
        flex: 1;
    }

    .filter-select {
        flex: 1;
    }

    .board-wrapper {
        padding: 16px 10px 32px;
    }

    .board {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .column {
        border-radius: 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal {
        border-radius: 20px 20px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-width: 100%;
        transform: translateY(100%);
    }

    .modal-overlay.open .modal {
        transform: translateY(0);
    }

    .toast-container {
        bottom: 16px;
        right: 10px;
        left: 10px;
    }

    .toast {
        min-width: unset;
        width: 100%;
    }
}