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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #eee;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0 20px;
}

header h1 {
    color: #e94560;
    font-size: 1.3rem;
}

.view-switcher {
    display: flex;
    gap: 8px;
}

.view-btn {
    padding: 8px 12px;
    background: #16213e;
    border: 2px solid transparent;
    border-radius: 8px;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
}

.view-btn:hover {
    background: #0f3460;
    color: #ccc;
}

.view-btn.active {
    background: #0f3460;
    border-color: #4a9eff;
    color: #4a9eff;
}

main {
    display: grid;
    grid-template-columns: 200px 1fr 280px;
    gap: 20px;
}

.sidebar {
    background: #16213e;
    border-radius: 12px;
    padding: 15px;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.sidebar h3 {
    color: #888;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    margin-top: 20px;
}

.sidebar h3:first-child {
    margin-top: 0;
}

.sidebar-header.collapsible {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    user-select: none;
}

.sidebar-header.collapsible:hover {
    color: #aaa;
}

.collapse-icon {
    font-size: 10px;
    transition: transform 0.2s;
}

.sidebar-header.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.nav-filters.collapsed {
    display: none;
}

.nav-filters {
    list-style: none;
}

.nav-filter-btn {
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    background: transparent;
    color: #ccc;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.nav-filter-btn:hover {
    background: #0f3460;
}

.nav-filter-btn.active {
    background: #4a9eff;
    color: white;
}

.nav-count {
    background: rgba(255,255,255,0.15);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.nav-filter-btn.active .nav-count {
    background: rgba(255,255,255,0.25);
}

section {
    background: #16213e;
    border-radius: 12px;
    padding: 20px;
}

.notes-section {
    height: fit-content;
    position: sticky;
    top: 20px;
}

h2 {
    margin-bottom: 20px;
    color: #4a9eff;
    font-size: 1.2rem;
}

.add-todo {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.add-todo #add-todo-btn {
    margin-left: auto;
}

#todo-input {
    flex: 2;
    min-width: 150px;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: #0f3460;
    color: #eee;
    font-size: 14px;
}

#todo-date {
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: #0f3460;
    color: #eee;
    font-size: 14px;
}

#todo-category {
    flex: 1;
    min-width: 100px;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: #0f3460;
    color: #eee;
    font-size: 14px;
}

#todo-input::placeholder,
#todo-category::placeholder {
    color: #666;
}

#todo-status {
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: #0f3460;
    color: #eee;
    font-size: 14px;
    cursor: pointer;
}

#status-filter {
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: #0f3460;
    color: #eee;
    font-size: 12px;
    cursor: pointer;
}

.todo-status-select {
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
}

.todo-status-select.status-inbox {
    background: #6b7280;
    color: white;
}

.todo-status-select.status-next {
    background: #3b82f6;
    color: white;
}

.todo-status-select.status-scheduled {
    background: #8b5cf6;
    color: white;
}

.todo-status-select.status-waiting {
    background: #f59e0b;
    color: white;
}

.todo-status-select.status-done {
    background: #10b981;
    color: white;
}

.todo-status-select.status-dropped {
    background: #4b5563;
    color: #9ca3af;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #888;
    flex-wrap: wrap;
}

.sort-btn {
    padding: 8px 16px;
    font-size: 12px;
    background: #0f3460;
    color: #888;
}

.sort-btn.active {
    background: #4a9eff;
    color: white;
}

.sort-btn:hover {
    background: #4a9eff;
    color: white;
}

.filter-separator {
    color: #444;
}

#category-filter {
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: #0f3460;
    color: #eee;
    font-size: 12px;
    cursor: pointer;
}

.manage-btn {
    padding: 8px 12px;
    font-size: 12px;
    background: #4a4a6a;
}

.manage-btn:hover {
    background: #6a6a9a;
}

.add-category {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#new-category-input {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: #0f3460;
    color: #eee;
    font-size: 14px;
}

#new-category-input::placeholder {
    color: #666;
}

#category-list-manage {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #0f3460;
    border-radius: 8px;
    margin-bottom: 8px;
}

.category-name {
    flex: 1;
    font-weight: 500;
}

.category-count {
    color: #888;
    font-size: 12px;
}

.category-rename-btn {
    padding: 6px 12px;
    font-size: 12px;
    background: #4a9eff;
}

.category-delete-btn {
    padding: 6px 12px;
    font-size: 12px;
    background: #666;
}

.category-delete-btn:hover {
    background: #e94560;
}

.no-categories {
    color: #666;
    text-align: center;
    padding: 20px;
}

.no-todos {
    color: #666;
    text-align: center;
    padding: 20px;
    list-style: none;
}

button {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background: #e94560;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

button:hover {
    background: #ff6b6b;
}

#todo-list {
    list-style: none;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #0f3460;
    border-radius: 8px;
    margin-bottom: 10px;
}

.todo-item.completed .todo-text {
    text-decoration: line-through;
    opacity: 0.5;
}

.todo-item.completed .todo-meta {
    opacity: 0.5;
}

.todo-item.overdue {
    border-left: 3px solid #e94560;
}

.todo-content {
    flex: 1;
    min-width: 0;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.todo-content:hover {
    background: rgba(74, 158, 255, 0.1);
}

.has-note-indicator {
    color: #4a9eff;
    font-size: 10px;
}

.todo-text {
    display: block;
    margin-bottom: 4px;
}

.todo-meta {
    display: flex;
    gap: 10px;
    font-size: 12px;
}

.todo-date {
    color: #888;
}

.todo-date.overdue {
    color: #e94560;
    font-weight: bold;
}

.todo-category-tag {
    color: #4a9eff;
    background: rgba(74, 158, 255, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
}

.todo-note-btn {
    padding: 6px 12px;
    font-size: 12px;
    background: #4a9eff;
}

.todo-note-btn.has-note {
    background: #26a69a;
}

.todo-delete-btn {
    padding: 6px 12px;
    font-size: 12px;
    background: #666;
}

.todo-delete-btn:hover {
    background: #e94560;
}

#notes-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.note-card {
    background: #0f3460;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: transform 0.2s;
}

.note-card:hover {
    transform: translateX(5px);
}

.note-card h4 {
    color: #4a9eff;
    margin-bottom: 8px;
}

.note-card p {
    color: #aaa;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #16213e;
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
}

.modal-content h3 {
    margin-bottom: 15px;
    color: #e94560;
}

.task-edit-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.task-edit-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.task-edit-row label {
    min-width: 80px;
    color: #888;
    font-size: 13px;
}

.task-edit-row input,
.task-edit-row select {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 6px;
    background: #0f3460;
    color: #eee;
    font-size: 14px;
}

.note-label {
    display: block;
    color: #888;
    font-size: 13px;
    margin-bottom: 8px;
}

#note-textarea {
    width: 100%;
    height: 150px;
    padding: 15px;
    border: none;
    border-radius: 8px;
    background: #0f3460;
    color: #eee;
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
}

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

#close-modal-btn {
    background: #666;
}

/* Sidebar action button */
.sidebar-action-btn {
    width: 100%;
    margin-top: 15px;
    padding: 10px;
    font-size: 12px;
    background: #4a4a6a;
    border: 1px dashed #6a6a8a;
}

.sidebar-action-btn:hover {
    background: #5a5a7a;
}

/* Bundle modals */
.modal-wide {
    max-width: 600px;
}

.add-bundle,
.add-bundle-task {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

#new-bundle-input,
#new-bundle-task-input {
    flex: 1;
    min-width: 150px;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: #0f3460;
    color: #eee;
    font-size: 14px;
}

#new-bundle-task-category {
    width: 120px;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: #0f3460;
    color: #eee;
    font-size: 14px;
}

#new-bundle-task-status {
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: #0f3460;
    color: #eee;
    font-size: 14px;
}

#bundle-list-manage,
#bundle-tasks-list,
#bundle-preview-list {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
}

.bundle-item,
.bundle-task-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #0f3460;
    border-radius: 8px;
    margin-bottom: 8px;
}

.bundle-name,
.bundle-task-name {
    flex: 1;
    font-weight: 500;
}

.bundle-task-count {
    color: #888;
    font-size: 12px;
}

.bundle-task-meta {
    font-size: 11px;
    color: #888;
}

.bundle-use-btn {
    padding: 6px 12px;
    font-size: 12px;
    background: #10b981;
}

.bundle-use-btn:hover {
    background: #34d399;
}

.bundle-edit-btn {
    padding: 6px 12px;
    font-size: 12px;
    background: #4a9eff;
}

.bundle-delete-btn,
.bundle-task-delete-btn {
    padding: 6px 12px;
    font-size: 12px;
    background: #666;
}

.bundle-delete-btn:hover,
.bundle-task-delete-btn:hover {
    background: #e94560;
}

.bundle-description {
    color: #888;
    font-size: 13px;
    margin-bottom: 15px;
}

.bundle-preview-item {
    padding: 10px 12px;
    background: #0f3460;
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 13px;
}

.bundle-preview-meta {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
}

.bundle-options {
    margin: 20px 0;
}

.bundle-options label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #ccc;
}

.bundle-options label span {
    min-width: 120px;
}

.bundle-options input {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 6px;
    background: #0f3460;
    color: #eee;
    font-size: 13px;
}

.no-bundles {
    color: #666;
    text-align: center;
    padding: 20px;
    font-size: 13px;
}

/* Sidebar bundle buttons */
.bundle-sidebar-btn {
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    background: transparent;
    color: #10b981;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.bundle-sidebar-btn:hover {
    background: #0f3460;
}

@media (max-width: 1000px) {
    main {
        grid-template-columns: 180px 1fr;
    }
    .notes-section {
        display: none;
    }
}

@media (max-width: 700px) {
    main {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: static;
    }
}

/* Calendar View */
.calendar-view {
    background: #16213e;
    border-radius: 12px;
    padding: 20px;
}

.calendar-view.hidden {
    display: none;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.calendar-header h2 {
    margin: 0;
    min-width: 180px;
    text-align: center;
}

.calendar-nav-btn {
    padding: 8px 16px;
    background: #0f3460;
    font-size: 16px;
}

.calendar-nav-btn:hover {
    background: #4a9eff;
}

.today-btn {
    padding: 8px 16px;
    background: #4a9eff;
    font-size: 13px;
}

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

.calendar-day {
    background: #0f3460;
    border-radius: 8px;
    min-height: 150px;
    padding: 10px;
}

.calendar-day.today {
    border: 2px solid #4a9eff;
}

.calendar-day.other-month {
    opacity: 0.5;
}

.calendar-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #1a1a2e;
}

.calendar-day-name {
    font-size: 11px;
    text-transform: uppercase;
    color: #888;
    letter-spacing: 1px;
}

.calendar-day-number {
    font-size: 18px;
    font-weight: bold;
    color: #4a9eff;
}

.calendar-day.today .calendar-day-number {
    background: #4a9eff;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-tasks {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.calendar-task {
    background: #1a1a2e;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    border-left: 3px solid #888;
    transition: transform 0.1s;
}

.calendar-task:hover {
    transform: translateX(2px);
}

.calendar-task.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.calendar-task[draggable="true"] {
    cursor: grab;
}

.calendar-day.drag-over {
    background: #1a3a5c;
    box-shadow: inset 0 0 0 2px #4a9eff;
}

.calendar-task.status-inbox {
    border-left-color: #6b7280;
}

.calendar-task.status-next {
    border-left-color: #3b82f6;
}

.calendar-task.status-scheduled {
    border-left-color: #8b5cf6;
}

.calendar-task.status-waiting {
    border-left-color: #f59e0b;
}

.calendar-task.status-done {
    border-left-color: #10b981;
    opacity: 0.6;
    text-decoration: line-through;
}

.calendar-task.status-dropped {
    border-left-color: #4b5563;
    opacity: 0.5;
    text-decoration: line-through;
}

.calendar-task-category {
    font-size: 10px;
    color: #4a9eff;
    margin-top: 2px;
}

.no-tasks-day {
    color: #555;
    font-size: 11px;
    font-style: italic;
}

@media (max-width: 900px) {
    .calendar-grid {
        grid-template-columns: 1fr;
    }

    .calendar-day {
        min-height: auto;
    }
}

/* Celebration explosion effect */
.celebration-container {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
}

.celebration-text {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8), 2px 2px 4px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    animation: celebrationText 1.2s ease-out forwards;
    transform: translate(-50%, -50%);
}

@keyframes celebrationText {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.5);
    }
    20% {
        transform: translate(-50%, -50%) scale(1.3);
    }
    40% {
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -150%) scale(1.2);
    }
}

.celebration-particle {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: particleExplode 0.8s ease-out forwards;
}

@keyframes particleExplode {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(0);
    }
}

.celebration-spark {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 6px 2px currentColor;
    animation: sparkExplode 0.6s ease-out forwards;
}

@keyframes sparkExplode {
    0% {
        opacity: 1;
        transform: translate(0, 0);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty));
    }
}

.celebration-star {
    position: absolute;
    font-size: 20px;
    animation: starExplode 1s ease-out forwards;
}

@keyframes starExplode {
    0% {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) rotate(360deg) scale(0);
    }
}

/* Auth Modal Styles */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.auth-modal.hidden {
    display: none;
}

.auth-modal-content {
    background: #16213e;
    padding: 40px;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.auth-modal-content h2 {
    color: #e94560;
    margin-bottom: 24px;
    text-align: center;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-form input {
    padding: 14px 16px;
    border: 2px solid #333;
    border-radius: 8px;
    background: #0f3460;
    color: #eee;
    font-size: 1rem;
}

.auth-form input:focus {
    outline: none;
    border-color: #4a9eff;
}

.auth-form button {
    padding: 14px;
    background: #e94560;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.auth-form button:hover {
    background: #d63850;
}

.auth-switch {
    text-align: center;
    color: #888;
    font-size: 0.9rem;
}

.auth-switch a {
    color: #4a9eff;
    text-decoration: none;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.auth-error {
    color: #e94560;
    text-align: center;
    font-size: 0.9rem;
    min-height: 20px;
}

/* Header right section */
.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

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

#userEmail {
    color: #888;
    font-size: 0.85rem;
}

.logout-btn {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid #666;
    color: #888;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.logout-btn:hover {
    border-color: #e94560;
    color: #e94560;
}
