/* ================================================
   TODO APP CSS
================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #0a0a0f;
    --bg2: #111118;
    --card: rgba(255, 255, 255, 0.04);
    --border: rgba(255, 255, 255, 0.08);
    --text: #f0f0f5;
    --text-muted: #8888aa;
    --accent: #7c3aed;
    --accent2: #a855f7;
    --accent3: #06b6d4;
    --success: #56e84c;
    --danger: #ff4e4e;
    --warning: #f7b731;
    --gradient: linear-gradient(135deg, #7c3aed, #a855f7, #06b6d4);
    --radius: 14px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', system-ui, sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* NAV */
.app-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
}

.app-nav-back {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 7px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.app-nav-back:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}

.app-nav-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-nav-stats {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 6px 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
}

/* MAIN LAYOUT */
.todo-main {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 0;
    min-height: calc(100vh - 64px);
}

/* SIDEBAR */
.todo-sidebar {
    padding: 24px 20px;
    border-right: 1px solid var(--border);
    background: var(--bg2);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.add-card,
.filter-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    backdrop-filter: blur(8px);
}

.add-card-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    margin-bottom: 18px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-row label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.form-row input,
.form-row textarea,
.form-row select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.87rem;
    color: var(--text);
    font-family: var(--font);
    outline: none;
    transition: var(--transition);
    resize: vertical;
}

.form-row input::placeholder,
.form-row textarea::placeholder {
    color: rgba(136, 136, 170, 0.5);
}

.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
    border-color: var(--accent);
    background: rgba(124, 58, 237, 0.06);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.form-row select option {
    background: #1a1a24;
}

.optional {
    font-weight: 400;
    opacity: 0.6;
}

/* TYPE TOGGLE */
.type-toggle {
    display: flex;
    gap: 8px;
}

.type-btn {
    flex: 1;
    padding: 9px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.type-btn.active {
    background: rgba(124, 58, 237, 0.2);
    border-color: rgba(124, 58, 237, 0.5);
    color: var(--accent2);
}

/* PRIORITY */
.priority-group {
    display: flex;
    gap: 8px;
}

.priority-btn {
    flex: 1;
    padding: 7px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.priority-btn[data-priority="low"].active {
    background: rgba(86, 232, 76, 0.15);
    border-color: rgba(86, 232, 76, 0.4);
    color: var(--success);
}

.priority-btn[data-priority="medium"].active {
    background: rgba(247, 183, 49, 0.15);
    border-color: rgba(247, 183, 49, 0.4);
    color: var(--warning);
}

.priority-btn[data-priority="high"].active {
    background: rgba(255, 78, 78, 0.15);
    border-color: rgba(255, 78, 78, 0.4);
    color: var(--danger);
}

/* BUTTONS */
.add-btn {
    width: 100%;
    padding: 11px;
    border: none;
    border-radius: 9px;
    background: var(--gradient);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.35);
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(124, 58, 237, 0.5);
}

.clear-btn {
    width: 100%;
    padding: 9px;
    border-radius: 8px;
    border: 1px solid rgba(255, 78, 78, 0.3);
    background: rgba(255, 78, 78, 0.07);
    color: var(--danger);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.clear-btn:hover {
    background: rgba(255, 78, 78, 0.15);
}

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

.search-wrap i {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.search-wrap input {
    padding-left: 32px !important;
}

/* MAIN LIST */
.todo-list-section {
    padding: 28px 32px;
    overflow-y: auto;
}

.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.list-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.result-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--card);
    border: 1px solid var(--border);
    padding: 4px 12px;
    border-radius: 20px;
}

.todo-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ITEM CARD */
.todo-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    backdrop-filter: blur(8px);
    transition: var(--transition);
    animation: itemSlideIn 0.3s ease;
}

@keyframes itemSlideIn {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }

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

.todo-item:hover {
    border-color: rgba(124, 58, 237, 0.25);
}

.todo-item.done {
    opacity: 0.55;
}

.todo-item.done .item-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

.item-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    margin-top: 2px;
    color: transparent;
    font-size: 0.7rem;
}

.todo-item.done .item-check {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.item-type-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.item-type-icon.task {
    background: rgba(124, 58, 237, 0.15);
    color: var(--accent2);
}

.item-type-icon.note {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent3);
}

.item-body {
    flex: 1;
    min-width: 0;
}

.item-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-detail {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 8px;
}

.item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.item-cat {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.item-priority {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}

.item-priority.low {
    background: rgba(86, 232, 76, 0.1);
    color: var(--success);
    border: 1px solid rgba(86, 232, 76, 0.25);
}

.item-priority.medium {
    background: rgba(247, 183, 49, 0.1);
    color: var(--warning);
    border: 1px solid rgba(247, 183, 49, 0.25);
}

.item-priority.high {
    background: rgba(255, 78, 78, 0.1);
    color: var(--danger);
    border: 1px solid rgba(255, 78, 78, 0.25);
}

.item-date {
    font-size: 0.7rem;
    color: rgba(136, 136, 170, 0.5);
}

.item-delete {
    background: none;
    border: none;
    color: rgba(255, 78, 78, 0.4);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition);
    flex-shrink: 0;
}

.item-delete:hover {
    color: var(--danger);
    background: rgba(255, 78, 78, 0.1);
}

/* EMPTY STATE */
.empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
    color: var(--text-muted);
    gap: 12px;
}

.empty-state i {
    font-size: 3rem;
    opacity: 0.3;
}

.empty-state p {
    font-size: 1.2rem;
    font-weight: 600;
    opacity: 0.5;
}

.empty-state span {
    font-size: 0.85rem;
    opacity: 0.4;
}

.empty-state.show {
    display: flex;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .todo-main {
        grid-template-columns: 1fr;
    }

    .todo-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .todo-list-section {
        padding: 20px 16px;
    }

    .app-nav {
        padding: 0 16px;
    }

    .app-nav-title {
        display: none;
    }
}