/* TaskFlow stylesheet - Slate/purple theme */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #13111a;
    --surface: #1c1926;
    --surface2: #252234;
    --border: #322e44;
    --text: #e4e0f0;
    --text-muted: #867fa3;
    --primary: #7c6ef0;
    --primary-hover: #6b5dd9;
    --primary-soft: rgba(124, 110, 240, 0.12);
    --amber: #f0a535;
    --sky: #45b8e8;
    --green: #4cd9a0;
    --rose: #f06b7e;
    --radius: 10px;
}

/* min-height: 100vh on .app-layout handles full-height; no need for html/body height */

.hidden {
    display: none !important;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
}

/* Welcome Screen */
.welcome-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    z-index: 200;
    animation: fadeUp 0.5s ease;
}

.welcome-screen.hide {
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.welcome-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 42px 36px;
    max-width: 430px;
    width: 92%;
    text-align: center;
}

.welcome-icon {
    font-size: 44px;
    margin-bottom: 12px;
}

.welcome-card h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 10px;
}

.welcome-card > p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 22px;
}

.welcome-form {
    text-align: left;
}

.welcome-form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.welcome-input-row {
    display: flex;
    gap: 8px;
}

.welcome-input-row input {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}

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

/* Main Application Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
    animation: fadeUp 0.35s ease;
}

/* ---- Sidebar ---- */
.sidebar {
    width: 255px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    flex-shrink: 0;
    overflow-y: auto;
}

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

.brand-icon { font-size: 20px; }

.brand h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.brand-sub {
    font-size: 11px;
    color: var(--text-muted);
}

/* ---- Stats panel ---- */
.stats-panel {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.stats-panel h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    align-self: flex-start;
}

.progress-ring-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.progress-ring__circle-bg { stroke: var(--border); }

.progress-ring__circle {
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    transition: stroke-dashoffset 0.5s ease;
}

.progress-text {
    position: absolute;
    text-align: center;
}

#completion-percentage {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.progress-text small {
    font-size: 11px;
    color: var(--text-muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    border-top: 1px solid var(--border);
    padding-top: 12px;
    text-align: center;
}

.stat-item:first-child {
    border-right: 1px solid var(--border);
}

.stat-num {
    display: block;
    font-size: 22px;
    font-weight: 700;
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
}

/* ---- Filters ---- */
.filters-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.filters-nav h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.filter-btn {
    background: transparent;
    border: none;
    padding: 7px 10px;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 13px;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}

.filter-btn:hover {
    background: var(--surface2);
    color: var(--text);
}

.filter-btn.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

/* ---- Sidebar footer ---- */
.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding-top: 14px;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sidebar-footer strong { color: var(--primary); }

.sidebar-links {
    display: flex;
    align-items: center;
    gap: 6px;
}

.link-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.link-btn:hover { color: var(--text); }
.link-btn.danger:hover { color: var(--rose); }

.link-sep { color: var(--border); font-size: 10px; }

.footer-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 4px 0;
}

.sidebar-footer a {
    color: var(--primary);
    text-decoration: none;
}
.sidebar-footer a:hover { text-decoration: underline; }

.project-note {
    font-size: 11px;
    color: #4d4870;
}

/* ---- Main content ---- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ---- Header ---- */
.main-header {
    padding: 20px 24px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.header-title h1 {
    font-size: 20px;
    font-weight: 700;
}

#current-date {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

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

/* Search */
.search-bar {
    position: relative;
    display: flex;
    align-items: center;
}

.search-svg {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-bar input {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 12px 7px 32px;
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    width: 200px;
    transition: border-color 0.2s;
}

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

/* Date filter */
.date-filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.date-filter-group select {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 10px;
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
}

.date-filter-group select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: background 0.15s, transform 0.1s;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--border); }

/* ---- Board ---- */
.board-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    padding: 18px 24px;
    flex: 1;
    overflow-y: auto;
    align-items: start;
}

.board-column {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 280px;
}

.col-todo     { border-top: 3px solid var(--amber); }
.col-progress { border-top: 3px solid var(--sky); }
.col-done     { border-top: 3px solid var(--green); }

.column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-todo     { background: var(--amber); }
.dot-progress { background: var(--sky); }
.dot-done     { background: var(--green); }

.column-header h2 {
    font-size: 14px;
    font-weight: 600;
    flex: 1;
}

.task-count {
    background: var(--surface2);
    color: var(--text-muted);
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 20px;
}

/* ---- Task list & empty state ---- */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.empty-state {
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    padding: 28px 10px;
    border: 1px dashed var(--border);
    border-radius: 8px;
}

/* ---- Task cards ---- */
.task-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color 0.15s, transform 0.12s;
}

.task-card:hover {
    border-color: #4a4466;
    transform: translateY(-1px);
}

/* Don't apply hover lift on completed (faded) cards — looks odd at low opacity */
.task-card.completed:hover {
    transform: none;
}

.task-card.completed {
    opacity: 0.55;
}

.task-card.completed .task-card-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.task-card-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}

.priority-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.priority-low    { background: rgba(69,184,232,0.12);  color: var(--sky); }
.priority-medium { background: rgba(240,165,53,0.12);  color: var(--amber); }
.priority-high   { background: rgba(240,107,126,0.12); color: var(--rose); }

.task-desc-text {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.task-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}

.task-meta-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.task-due.overdue {
    color: var(--rose);
    font-weight: 600;
}

.task-actions {
    display: flex;
    gap: 2px;
}

.task-act-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 13px;
    transition: background 0.15s;
    color: var(--text-muted);
}

.task-act-btn:hover { background: var(--surface); }

/* ---- Modal ---- */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: opacity 0.2s;
}

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

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    width: 460px;
    max-width: 95%;
    position: relative;
    z-index: 1;
}

.modal-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 16px;
    font-weight: 700;
}

.close-modal-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
}

.close-modal-btn:hover { background: var(--surface2); color: var(--text); }

form {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

form label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

input[type="text"],
input[type="date"],
select,
textarea {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    width: 100%;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
}

textarea { resize: none; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid var(--border);
    padding-top: 14px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .board-columns { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    .app-layout { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; gap: 14px; }
    /* Keep sidebar-footer visible on mobile so user controls remain accessible.
       Hiding it would make "Change name" and "Clear data" unreachable. */
    .sidebar-footer {
        width: 100%;
        border-top: none;
        padding-top: 0;
    }
    .sidebar-footer .project-note,
    .sidebar-footer .footer-divider { display: none; }
    .main-header { flex-direction: column; align-items: flex-start; }
    .header-actions { flex-wrap: wrap; }
    .search-bar input { width: 150px; }
}
