/* TodoBoard.css */
:root {
    --todo-primary: #8a735c; /* TomaNotes accent color */
    --todo-primary-soft: #f4efe9;
    --todo-bg: #f8f6f0; /* TomaNotes warm background */
    --todo-surface: #ffffff;
    --todo-text: #2c2c2c;
    --todo-muted: #969188;
    --todo-border: #e8e4df;
    --todo-red: #d96c6c;
    --todo-drawer-bg: #f5f2ea;
    --todo-drawer-active: rgba(138, 115, 92, 0.08);
    
    /* Layout Dimensions */
    --todo-sidebar-width: 280px;
    --todo-detail-width: 600px; /* Wider for TomaNotes style card */
}

.todo-shell {
    position: fixed;
    inset: 0;
    background-color: var(--todo-bg);
    color: var(--todo-text);
    font-family: "Playfair Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    overflow: hidden;
}

/* Mobile defaults (original logic) */
.todo-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    height: 100%;
    min-width: 0;
}

/* Header */
.todo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background-color: transparent;
    z-index: 10;
}

.todo-header-left, .todo-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.todo-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.03);
    color: var(--todo-text);
    border: none;
    cursor: pointer;
}

.todo-header-title {
    font-size: 28px;
    font-weight: 800;
    padding: 0 16px;
    margin-bottom: 12px;
}

/* Main Scroll Area */
.todo-main {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 100px 16px; /* Space for bottom nav and FAB */
}

/* Task Groups */
.todo-group {
    margin-bottom: 24px;
    background: var(--todo-surface);
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.02);
    overflow: hidden;
}

.todo-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #fcfcfc;
    border-bottom: 1px solid var(--todo-border);
}

.todo-group-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--todo-text);
}

.todo-group-action {
    font-size: 13px;
    color: var(--todo-primary);
    cursor: pointer;
}

/* Task Item */
.todo-item {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    border-bottom: 1px solid var(--todo-border);
    transition: background 0.2s;
    cursor: pointer;
}

.todo-item:last-child {
    border-bottom: none;
}

.todo-item:active {
    background: #f9f9f9;
}

.todo-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 6px;
    margin-right: 12px;
    margin-top: 2px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.todo-checkbox.checked {
    background-color: var(--todo-primary);
    border-color: var(--todo-primary);
}

.todo-checkbox.checked::after {
    content: '';
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translateY(-1px);
}

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

.todo-item-title {
    font-size: 16px;
    line-height: 1.4;
    color: var(--todo-text);
    margin-bottom: 4px;
    word-break: break-word;
}

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

.todo-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.todo-item-date {
    color: var(--todo-muted);
}

.todo-item-date.overdue {
    color: var(--todo-red);
}

.todo-item-list {
    color: var(--todo-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* View Switcher */
.todo-view-switcher {
    display: flex;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 12px;
    padding: 4px;
}

.todo-view-switcher button {
    background: transparent;
    border: none;
    padding: 6px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--todo-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.todo-view-switcher button.active {
    background: var(--todo-surface);
    color: var(--todo-text);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Calendar View */
.todo-calendar-view {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.todo-calendar-header-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: -40px; /* Align with header title */
}

.todo-calendar-grid {
    background: var(--todo-surface);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.02);
}

.todo-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--todo-muted);
    margin-bottom: 12px;
}

.todo-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.todo-calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
    font-weight: 500;
    color: var(--todo-text);
}

.todo-calendar-day:hover {
    background: rgba(0,0,0,0.03);
}

.todo-calendar-day.other-month {
    color: #d0d0d0;
}

.todo-calendar-day.today .todo-calendar-day-num {
    background: var(--todo-primary);
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.todo-calendar-day.selected {
    background: var(--todo-primary-soft);
    color: var(--todo-primary);
    box-shadow: 0 0 0 1px var(--todo-primary);
}

.todo-calendar-day-dots {
    display: flex;
    gap: 3px;
    margin-top: 4px;
}

.todo-calendar-day-dots .dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--todo-primary);
}

.todo-calendar-day-dots .dot-plus {
    font-size: 8px;
    line-height: 4px;
    color: var(--todo-primary);
    font-weight: bold;
}

.todo-calendar-tasks-header {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--todo-text);
}

.todo-calendar-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
    color: var(--todo-muted);
}

.todo-calendar-empty-icon {
    margin-bottom: 16px;
    opacity: 0.3;
}

.todo-calendar-empty-text {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.todo-calendar-empty-sub {
    font-size: 13px;
}

/* Quick Add (Bottom input) */
.todo-quick-add {
    position: fixed;
    bottom: 80px; /* Above bottom nav */
    left: 16px;
    right: 16px;
    background: var(--todo-surface);
    border-radius: 24px;
    padding: 12px 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 50;
    transition: transform 0.3s;
}

.todo-quick-add-input {
    border: none;
    outline: none;
    font-size: 16px;
    font-family: inherit;
    background: transparent;
    width: 100%;
}

.todo-quick-add-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.todo-quick-add-tools {
    display: flex;
    gap: 12px;
}

.todo-quick-add-tool {
    color: var(--todo-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
}

.todo-quick-add-expand {
    font-size: 12px;
    color: var(--todo-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.todo-quick-add-send {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--todo-primary);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.todo-quick-add-send:disabled {
    background: #e5e5e5;
    color: #999;
    cursor: not-allowed;
}

.todo-quick-add-send:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Bottom Nav */
.todo-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 10;
}

.todo-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #b0b0b0;
    width: 60px;
    height: 48px;
    border-radius: 12px;
}

.todo-nav-item.active {
    color: white;
    background: var(--todo-primary);
}

/* Drawer Overlay */
.todo-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

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

/* Drawer */
.todo-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 80%;
    max-width: 320px;
    background-color: var(--todo-drawer-bg);
    z-index: 101;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0,0,0,0.1);
}

.todo-drawer.open {
    transform: translateX(0);
}

.todo-drawer-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.todo-drawer-close-btn {
    display: block;
}

.todo-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.todo-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ccc;
    object-fit: cover;
}

.todo-username {
    font-weight: 600;
    font-size: 16px;
}

.todo-drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px;
}

.todo-drawer-section {
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    padding: 8px 0;
}

.todo-drawer-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px 4px;
    color: var(--todo-muted);
    font-size: 13px;
    font-weight: 600;
}

.todo-drawer-section-add {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.todo-drawer-section-add:hover {
    background: rgba(0,0,0,0.05);
}

.todo-drawer-divider {
    height: 1px;
    background-color: rgba(0,0,0,0.05);
    margin: 8px 16px;
}

.todo-drawer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin: 0 8px;
    border-radius: 10px;
    cursor: pointer;
}

.todo-drawer-item.active {
    background: var(--todo-drawer-active);
}

.todo-drawer-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    color: var(--todo-text);
}

.todo-drawer-item-icon {
    font-size: 18px;
}

.todo-drawer-item-count {
    font-size: 13px;
    color: var(--todo-muted);
}

.todo-drawer-footer {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--todo-text);
    font-weight: 500;
    border-top: 1px solid rgba(0,0,0,0.05);
    cursor: pointer;
}

/* Detail Modal */
.todo-detail-modal {
    position: fixed;
    inset: 0;
    background: var(--todo-surface);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.todo-detail-modal.open {
    transform: translateY(0);
}

.todo-detail-close-btn {
    display: block;
}

.todo-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--todo-border);
}

.todo-detail-list-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--todo-muted);
    padding: 6px 12px;
    background: rgba(0,0,0,0.03);
    border-radius: 16px;
}

.todo-detail-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.todo-detail-title-input {
    width: 100%;
    font-size: 24px;
    font-weight: 600;
    border: none;
    outline: none;
    background: transparent;
    color: var(--todo-text);
    margin-bottom: 16px;
}

.todo-detail-title-input::placeholder {
    color: #ccc;
}

.todo-detail-desc-input {
    width: 100%;
    min-height: 100px;
    font-size: 16px;
    border: none;
    outline: none;
    background: transparent;
    color: var(--todo-text);
    resize: none;
    line-height: 1.6;
}

.todo-detail-desc-input::placeholder {
    color: #ccc;
}

/* Markdown Toolbar */
.todo-markdown-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    margin-bottom: 16px;
    border: 1px solid var(--todo-border);
    align-items: center;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
}

.todo-md-btn {
    background: transparent;
    border: none;
    color: var(--todo-muted);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.todo-md-btn img {
    width: 18px;
    height: 18px;
    opacity: 0.55;
    transition: opacity 0.2s ease, transform 0.1s ease;
}

.todo-md-btn:hover {
    background: rgba(0, 0, 0, 0.04);
}

.todo-md-btn:hover img {
    opacity: 0.9;
    transform: scale(1.05);
}

.todo-md-btn:active img {
    transform: scale(0.95);
}

.todo-md-divider {
    width: 1px;
    height: 16px;
    background: var(--todo-border);
    margin: 0 6px;
}

.todo-detail-toolbar {
    padding: 12px 16px;
    border-top: 1px solid var(--todo-border);
    display: flex;
    gap: 16px;
    background: white;
}

.todo-detail-tool {
    color: var(--todo-muted);
    cursor: pointer;
}

/* --- Desktop Layout Overrides --- */
@media (min-width: 768px) {
    .todo-shell {
        flex-direction: row;
        background-color: var(--todo-surface);
    }

    /* Make drawer static on the left */
    .todo-drawer {
        position: relative;
        transform: none;
        width: var(--todo-sidebar-width);
        max-width: none;
        z-index: 1;
        box-shadow: none;
        border-right: 1px solid var(--todo-border);
        background-color: var(--todo-bg);
    }

    .todo-drawer-overlay {
        display: none;
    }

    .todo-drawer-close-btn {
        display: none;
    }

    .todo-drawer-header {
        padding: 16px 20px;
    }

    /* Main content area */
    .todo-content-area {
        flex: 1;
        background-color: var(--todo-surface);
    }

    .todo-header-left .todo-icon-btn {
        display: none; /* Hide hamburger */
    }

    .todo-header {
        padding: 24px 32px 12px;
    }

    .todo-header-title {
        padding: 0 32px;
    }

    .todo-main {
        padding: 0 32px 32px 32px;
    }

    .todo-bottom-nav {
        display: none;
    }

    .todo-quick-add {
        position: absolute;
        bottom: 32px;
        left: 50%;
        transform: translateX(-50%);
        width: 60%;
        max-width: 600px;
        border: 1px solid var(--todo-border);
        box-shadow: 0 8px 32px rgba(138, 115, 92, 0.08);
    }
    
    /* Static Detail Panel on the right (Card Style) */
    .todo-detail-modal {
        position: relative;
        transform: none;
        width: var(--todo-detail-width);
        border: 1px solid var(--todo-border);
        border-radius: 24px;
        background: var(--todo-surface);
        z-index: 1;
        display: none; /* Hidden until task selected */
        margin: 24px; /* TomaNotes style floating card */
        height: calc(100vh - 48px);
        box-shadow: 0 8px 32px rgba(138, 115, 92, 0.08);
    }

    .todo-detail-modal.open {
        display: flex;
    }

    .todo-detail-close-btn {
        display: none;
    }
}
