/* Reset và base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 0;
    margin: 0;
    color: #333;
    overflow-x: hidden; /* Ngăn scroll ngang */
}

.container {
    width: 100%;
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Ngăn scroll của container */
}

/* Login Screen */
.login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    width: 90%;
}

.login-header {
    margin-bottom: 30px;
}

.login-header i {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 15px;
}

.login-header h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.8rem;
}

.login-header p {
    color: #666;
    font-size: 0.9rem;
}

.google-login-btn {
    background: #4285f4;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.google-login-btn:hover {
    background: #3367d6;
    transform: translateY(-2px);
}

.google-login-btn i {
    font-size: 1.2rem;
}

.login-info {
    color: #666;
    font-size: 0.8rem;
}

.login-info i {
    color: #4285f4;
    margin-right: 5px;
}

/* Top Right Controls Container - Deprecated */
.top-right-controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    order: 7;
}

/* Button Group */
.button-group {
    display: flex;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: none;
    background: transparent;
}

/* Common Button Styles - Áp dụng cho cả mode-btn và filter-btn */
.button-group .mode-btn,
.filter-btn {
    border-radius: 30px;
    border: none;
    margin: 0;
    position: relative;
    background: linear-gradient(135deg, #e9ecef 0%, #c9d1d9 100%);
    color: #6c757d;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 0.9rem;
    text-shadow: none;
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Button Group specific styles */
.button-group .mode-btn {
    border-radius: 0;
    padding: 12px 16px;
}

.button-group .mode-btn:first-child {
    border-top-left-radius: 33px;
    border-bottom-left-radius: 33px;
}

.button-group .mode-btn:last-child {
    border-top-right-radius: 33px;
    border-bottom-right-radius: 33px;
}

/* Common hover styles */
.button-group .mode-btn:hover,
.filter-btn:hover {
    background: linear-gradient(135deg, #d1d9e0 0%, #b8c2cc 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

/* Common active styles */
.button-group .mode-btn.active,
.filter-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: none;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* User Avatar Container */
.user-avatar-container {
    position: relative;
    display: flex;
    align-items: center;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-avatar:hover {
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.05);
}

/* User Menu */
.user-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    min-width: 250px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    margin-top: 8px;
}

.user-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-info-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px 12px 0 0;
}

.user-menu-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    color: white;
    font-weight: 600;
    font-size: 1rem;
}

.user-email {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
}

.menu-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 0;
}

.menu-item {
    width: 100%;
    background: none;
    border: none;
    padding: 12px 16px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #333;
    font-size: 0.9rem;
}

.menu-item:hover {
    background: #f5f5f5;
}

.menu-item:has(.fa-trash-restore):hover {
    background: linear-gradient(135deg, rgba(255, 87, 34, 0.1), rgba(255, 87, 34, 0.05));
    color: #FF5722;
}

.menu-item i {
    width: 16px;
    text-align: center;
}

.menu-item.syncing i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Loading Message */
.loading-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #666;
}

.loading-spinner {
    font-size: 2rem;
    color: #667eea;
    margin-bottom: 20px;
}

.loading-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: #888;
}

/* Todo App Container */
.todo-app {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    width: 100%; /* Đảm bảo chiếm hết width */
}

/* Auto Backup Info in User Menu */
.auto-backup-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(76, 175, 80, 0.05));
    border: 1px solid rgba(76, 175, 80, 0.2);
    border-radius: 8px;
    margin: 8px 12px;
    text-align: center;
}

.auto-backup-info i {
    color: #4CAF50;
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.auto-backup-info span {
    color: #4CAF50;
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.2;
}

.auto-backup-info small {
    color: #666;
    font-size: 0.75rem;
    line-height: 1.2;
    opacity: 0.8;
}


/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    text-align: center;
    flex-shrink: 0;
}

.header h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    font-weight: 700;
}

.header h1 i {
    margin-right: 10px;
    color: #ffd700;
}

.header p {
    opacity: 0.9;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.create-project-btn {
    background: #667eea;
    color: white;
    border: 2px solid #667eea;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 600;
    order: 4;
}

.create-project-btn:hover {
    background: #5a6fd8;
    border-color: #5a6fd8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* .todo-btn và .calendar-btn styles đã được chuyển vào .button-group .filter-btn */
/* Sử dụng .button-group .filter-btn.active thay thế để đồng nhất */




/* Add Todo Button */
.add-todo-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.add-todo-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}


/* Search Container in Filter Section */
.search-container {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 300px;
    flex-shrink: 0;
}

#searchInput {
    flex: 1;
    padding: 12px 45px 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

#searchInput:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#searchInput:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#searchInput:not(:placeholder-shown) {
    background: white;
    border-color: #667eea;
}

.clear-search-btn {
    position: absolute;
    right: 5px;
    background: none;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    color: #999;
    transition: all 0.3s ease;
    display: none;
    align-items: center;
    justify-content: center;
}

.clear-search-btn:hover {
    background: #f0f0f0;
    color: #667eea;
}

.clear-search-btn.show {
    display: flex;
}


.search-highlight {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
    color: #856404;
}

/* Filter Section */
.filter-section {
    padding: 10px 30px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    gap: 20px;
    position: relative;
    min-height: 60px; /* Đảm bảo có đủ chiều cao cho button-group */
}

/* Left Section: DateTime + Todo-Calendar Buttons */
.left-section {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 0 0 auto;
    max-width: 50%; /* Tăng chiều rộng để chứa button-group */
}


/* Right Section: Search + Filter Buttons + Avatar */
.right-section {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 0 0 auto;
    max-width: 50%; /* Tăng chiều rộng để chứa search và filter buttons */
}

/* Current DateTime Display */
.current-datetime {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    flex-shrink: 0;
}

.current-datetime i {
    font-size: 0.85rem;
    opacity: 0.9;
}

.current-datetime span {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

/* Progress Section */
.progress-section {
    padding: 10px 30px;
    border-bottom: 1px solid #e0e0e0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    flex-shrink: 0;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.progress-text {
    font-weight: 600;
    color: #667eea;
    font-size: 0.9rem;
}

.progress-percentage {
    font-weight: 700;
    color: #667eea;
    font-size: 1.1rem;
}

.progress-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    transition: width 0.6s ease;
    position: relative;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        rgba(255,255,255,0.3) 0%, 
        rgba(255,255,255,0.1) 50%, 
        rgba(255,255,255,0.3) 100%);
    border-radius: 10px;
}

.progress-details {
    text-align: center;
    color: #666;
    font-size: 0.85rem;
    font-weight: 500;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Filter button styles đã được gộp vào Common Button Styles ở trên */

/* Cycle button styling - sử dụng style chung từ Common Button Styles */

.filter-btn.cycle-btn .cycle-text {
    font-weight: 600;
}

/* Action buttons container */
.action-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.action-btn {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    color: #666;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.action-btn:hover {
    border-color: #ff9800;
    color: #ff9800;
    transform: translateY(-1px);
}

.action-btn:active {
    transform: translateY(0);
}


/* Multi Project Container */
.multi-project-container {
    display: flex;
    gap: 20px;
    padding: 20px 30px;
    overflow-x: auto;
    flex: 1;
    min-height: calc(100vh - 80px);
    background: #f8f9fa;
    transition: background-color 0.3s ease;
    position: relative;
}

/* Tối ưu hiệu suất khi đang scroll */
.multi-project-container.scrolling {
    scroll-behavior: auto; /* Tắt smooth scroll khi đang scroll thủ công */
}


.multi-project-container::-webkit-scrollbar {
    height: 8px;
}

.multi-project-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.multi-project-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.multi-project-container::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Project Column */
.project-column {
    min-width: 350px;
    max-width: 400px;
    flex: 1;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 2px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    cursor: default;
    scroll-snap-align: center; /* Căn giữa khi scroll */
}

.project-header-small {
    padding: 15px 20px;
    color: white;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
    flex-shrink: 0;
}

.project-title-small {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    flex: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.project-todo-count-small {
    font-size: 0.8rem;
    opacity: 0.8;
    font-weight: 500;
    margin-left: 4px;
}

/* Project Header Content */
.project-header-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

/* Project Actions */
.project-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}


/* Todo List */
.todo-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    min-height: 300px;
    position: relative; /* Cần thiết để sticky hoạt động */
}

.empty-project {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-project i {
    font-size: 2rem;
    margin-bottom: 10px;
    color: #ddd;
}

.empty-project p {
    margin: 0;
    font-size: 0.9rem;
}

/* Hierarchical Structure */
.todo-item {
    --indent-level: 0;
    --indent-size: 30px;
    margin-left: calc(var(--indent-level) * var(--indent-size));
}

.todo-item.level-1 { --indent-level: 1; }
.todo-item.level-2 { --indent-level: 2; }
.todo-item.level-3 { --indent-level: 3; }
.todo-item.level-4 { --indent-level: 4; }
.todo-item.level-5 { --indent-level: 5; }
.todo-item.level-6 { --indent-level: 6; }
.todo-item.level-7 { --indent-level: 7; }
.todo-item.level-8 { --indent-level: 8; }
.todo-item.level-9 { --indent-level: 9; }
.todo-item.level-10 { --indent-level: 10; }

/* Hierarchical visual indicators */
.todo-item[class*="level-"] {
    border-left: 3px solid transparent;
    position: relative;
}

/* Todo gốc (root todos) - không có parentId, level = 0 */
.todo-item:not([class*="level-"]) {
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease; /* Smooth transition cho mọi thay đổi */
    border-radius: 0; /* Đảm bảo không có border-radius khi sticky */
    border-left: 4px solid #667eea; /* Màu border dày hơn cho todo gốc */
    font-weight: 600; /* Todo gốc có font đậm hơn */
}

/* Enhance sticky effect khi scroll cho todo gốc */
.todo-item:not([class*="level-"]).sticky-active {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.98); /* Slight transparency để thấy content bên dưới */
    backdrop-filter: blur(2px); /* Hiệu ứng blur nhẹ */
}

/* Đảm bảo Todo Root luôn có background solid khi không sticky */
.todo-item:not([class*="level-"]):not(.sticky-active) {
    background: white;
}

/* Todo gốc border effect - không dùng gradient */
.todo-item:not([class*="level-"])::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #667eea; /* Màu solid cho todo gốc */
}

.todo-item.level-1 {
    border-left-color: #4CAF50;
    z-index: 5; /* Thấp hơn todo gốc để nằm dưới sticky header */
}

.todo-item.level-1::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #4CAF50; /* Màu solid cho level-1 */
}

.todo-item.level-2 {
    border-left-color: #FF9800;
    z-index: 4; /* Thấp hơn level-1 */
}

.todo-item.level-2::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #FF9800; /* Màu solid cho level-2 */
}

.todo-item.level-3 {
    border-left-color: #9C27B0;
    z-index: 3; /* Thấp hơn level-2 */
}

.todo-item.level-3::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #9C27B0; /* Màu solid cho level-3 */
}

.todo-item.level-4 {
    border-left-color: #F44336;
    z-index: 2; /* Thấp hơn level-3 */
}

.todo-item.level-4::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #F44336; /* Màu solid cho level-4 */
}

.todo-item.level-5 {
    border-left-color: #00BCD4;
    z-index: 1; /* Thấp hơn level-4 */
}

.todo-item.level-5::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #00BCD4; /* Màu solid cho level-5 */
}

.todo-item.level-6 {
    border-left-color: #795548;
    z-index: 1; /* Thấp hơn level-5 */
}

.todo-item.level-6::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #795548; /* Màu solid cho level-6 */
}

/* For deeper levels, use a cycling color pattern */
.todo-item.level-7 { 
    border-left-color: #607D8B; 
    z-index: 1; 
}

.todo-item.level-8 { 
    border-left-color: #E91E63; 
    z-index: 1; 
}

.todo-item.level-9 { 
    border-left-color: #3F51B5; 
    z-index: 1; 
}

.todo-item.level-10 { 
    border-left-color: #FF5722; 
    z-index: 1; 
}

.todo-item.level-7::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #607D8B;
}

.todo-item.level-8::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #E91E63;
}

.todo-item.level-9::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #3F51B5;
}

.todo-item.level-10::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #FF5722;
}

/* For levels beyond 10, use a default style */
.todo-item[class*="level-"]:not(.level-1):not(.level-2):not(.level-3):not(.level-4):not(.level-5):not(.level-6):not(.level-7):not(.level-8):not(.level-9):not(.level-10) {
    border-left-color: #999;
    z-index: 1; /* Thấp hơn level-1 để nằm dưới sticky header */
}

.todo-item[class*="level-"]:not(.level-1):not(.level-2):not(.level-3):not(.level-4):not(.level-5):not(.level-6):not(.level-7):not(.level-8):not(.level-9):not(.level-10)::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #999; /* Màu solid cho level > 10 */
}

.todo-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(245, 247, 250, 0.95));
    box-shadow: 0 12px 30px rgba(118, 75, 162, 0.1);
    transition: all 0.25s ease;
    cursor: pointer;
}

.todo-item.highlight-todo {
    animation: todoHighlight 2s ease;
    border-color: #ffc107;
}

@keyframes todoHighlight {
    0% {
        box-shadow: 0 0 0 rgba(255, 193, 7, 0.7);
    }
    50% {
        box-shadow: 0 0 18px rgba(255, 193, 7, 0.9);
    }
    100% {
        box-shadow: 0 0 0 rgba(255, 193, 7, 0);
    }
}

.todo-item:hover {
    background: rgba(102, 126, 234, 0.05);
}

.todo-content {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    position: relative;
    height: 100%; /* Chiếm hết height của todo-item */
}


.todo-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid #ddd;
    border-radius: 50%;
    margin-right: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.todo-skip-icon {
    width: 24px;
    height: 24px;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #ff9800;
    font-size: 0.9rem;
    opacity: 0.8;
}

.todo-checkbox:hover {
    border-color: #4CAF50;
}

/* Disable hover effects in selection modes */
.parent-selection-mode .todo-checkbox:hover,
.move-selection-mode .todo-checkbox:hover {
    border-color: #ddd;
}

.todo-checkbox.completed {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
}

/* Todo Dropdown Styling */
.todo-checkbox {
    position: relative;
    cursor: pointer;
}


/* Checkbox hiển thị time-blocks: 10, 20, 30, 1h, 2h */
.todo-checkbox.completed {
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.todo-text {
    flex: 1;
    font-size: 1rem;
    line-height: 1.5;
    word-break: break-word;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 100%; /* Chiếm hết height của todo-content */
    user-select: none; /* Ngăn chọn text */
}

.todo-text-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.todo-text-content {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

/* Scheduled icon display */
.scheduled-icon {
    margin-right: 6px;
    font-size: 0.9rem;
    opacity: 0.8;
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-block;
}

.scheduled-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Scheduled detail display */
.scheduled-detail {
    font-size: 0.8rem;
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
    margin-left: 20px; /* Căn chỉnh với text content */
    border-left: 3px solid #667eea;
    font-weight: 500;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes weekSlideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
        padding: 0 1px;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 20px;
        padding: 2px 1px;
    }
}

@keyframes weekSlideUp {
    from {
        opacity: 1;
        transform: translateY(0);
        max-height: 20px;
        padding: 2px 1px;
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
        padding: 0 1px;
    }
}

/* Week indicator - dải 7 ngày */
.week-indicator {
    width: 100%;
    height: 20px;
    display: flex;
    gap: 2px;
    margin: 0;
    padding: 2px 1px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    animation: weekSlideDown 0.3s ease-out;
    overflow: hidden;
}

.week-indicator.closing {
    animation: weekSlideUp 0.3s ease-out forwards;
    pointer-events: none; /* Disable interaction during closing */
}

.day-box {
    flex: 1;
    height: 100%;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 2px;
    transition: all 0.2s ease;
    cursor: help;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #999;
    text-align: center;
    line-height: 1;
    padding: 1px;
}

.day-box.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 1px 3px rgba(102, 126, 234, 0.3);
    color: white;
    /* text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); */
}

.day-box.past {
    background: #f8f8f8;
    color: #999;
}

.day-box:hover {
    transform: scaleY(1.2);
}


/* Hiệu ứng nhấp nháy cho todo cần làm trước */
.blink-effect {
    animation: blink 0.5s ease-in-out 4;
    border: 2px solid #ff6b6b !important;
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.5) !important;
}

@keyframes blink {
    0%, 50% { 
        opacity: 1; 
        background-color: rgba(255, 107, 107, 0.1);
    }
    25%, 75% { 
        opacity: 0.7; 
        background-color: rgba(255, 107, 107, 0.2);
    }
}

/* Category Management Modal */
.category-management-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    max-width: 1000px;
    width: 95%;
    max-height: 80vh;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.category-management-modal.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.category-management-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.category-management-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.category-close-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.category-close-btn:hover {
    background: #e9ecef;
    color: #333;
    transform: scale(1.1);
}

.category-management-content {
    padding: 24px;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
    min-height: 600px;
}

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

.category-list-header h4,
.todo-list-header h4 {
    margin-bottom: 0;
    color: #333;
    font-weight: 600;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 8px;
    flex: 1;
}


/* Category List */
.category-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    max-height: 540px;
    overflow-y: auto;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    position: relative;
}

.category-item:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.category-item.active {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.category-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

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

/* Delete category button - đã bỏ vì sử dụng context menu */

.add-category-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: 2px dashed #667eea;
    border-radius: 6px;
    background: rgba(102, 126, 234, 0.05);
    color: #667eea;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
}

.add-category-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: #5a6fd8;
}

/* Todo Root List */
.todo-root-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 540px;
    overflow-y: auto;
}

.todo-root-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    transition: all 0.2s ease;
}

.todo-root-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.todo-root-content {
    display: flex;
    align-items: center;
    flex: 1;
}

.todo-root-text {
    font-weight: 500;
    color: #333;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.todo-root-actions {
    margin-left: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}


/* Project Header Bottom Layout */
.project-header-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
}

/* Project Category Display */
.project-category-display {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    color: #333;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    /* Cho phép mở rộng theo nội dung thay vì giới hạn max-width */
    width: auto;
    min-width: fit-content;
    /* Đảm bảo height đồng nhất với add-todo-btn */
    height: 32px;
    box-sizing: border-box;
}

.project-category-display:hover {
    background: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.project-category-display .category-name {
    font-weight: 500;
    white-space: nowrap;
    /* Bỏ overflow và text-overflow để hiển thị hết chữ */
    /* overflow: hidden; */
    /* text-overflow: ellipsis; */
    /* max-width: 120px; */
}

.project-category-display .fas {
    font-size: 0.7rem;
    opacity: 0.7;
    color: #666;
}

/* Category Context Menu */
.category-context-menu {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    min-width: 200px;
    overflow: hidden;
    z-index: 10000;
    padding: 8px 0;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 0.9rem;
    color: #333;
}

.context-menu-item:hover {
    background-color: #f5f5f5;
}

.context-menu-item.selected {
    background-color: #e3f2fd;
    color: #1976d2;
    font-weight: 500;
}

.context-menu-item .fas {
    width: 16px;
    text-align: center;
    color: #666;
}

.context-menu-item.selected .fas {
    color: #1976d2;
}

.category-color-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.context-menu-divider {
    height: 1px;
    background-color: #e0e0e0;
    margin: 4px 0;
}

.context-menu-item.manage-category {
    color: #666;
    font-style: italic;
}

.context-menu-item.manage-category:hover {
    background-color: #f8f9fa;
    color: #333;
}

.category-count {
    margin-left: auto;
    background: #e3f2fd;
    color: #1976d2;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    min-width: 20px;
    text-align: center;
}

.context-menu-item.selected .category-count {
    background: #1976d2;
    color: white;
}

.empty-todo-list {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 40px 20px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    background: #f9f9f9;
}

.children-count {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
    margin-left: auto;
    margin-right: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    /* border: 2px solid transparent; Thêm border transparent để giữ height cố định */
    min-height: 24px; /* Đảm bảo height tối thiểu */
    height: 24px; /* Cố định height */
}

.children-count.expanded {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
    box-shadow: none;
}

.children-count.collapsed {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    /* border: 2px solid transparent; Giữ border transparent cho collapsed */
}

.children-count:hover {
    transform: scale(1.1);
}

.children-count.expanded:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: #4a5bb8;
}

.children-count.collapsed:hover {
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
}

/* Collapse Toggle Button */
.collapse-toggle-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 12px 16px;
    border-radius: 30px;
    width: 145px;
    text-align: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    user-select: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.collapse-toggle-btn:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Style khi Thu gọn (collapsed) - đồng nhất với current-datetime */
.collapse-toggle-btn.collapsed {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 30px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    font-weight: 600;
    font-size: 0.9rem;
}

.collapse-toggle-btn.collapsed:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.collapse-toggle-btn.collapsed i {
    transform: rotate(-90deg); /* Chevron-down xoay sang phải */
}

/* Style khi không Thu gọn (expanded) - màu ghi nhạt để phân biệt */
.collapse-toggle-btn.expanded {
    background: linear-gradient(135deg, #e9ecef 0%, #c9d1d9 100%);
    color: #6c757d;
    border: none;
    padding: 12px 16px;
    border-radius: 30px;
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
    text-shadow: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.collapse-toggle-btn.expanded:hover {
    background: linear-gradient(135deg, #d1d9e0 0%, #b8c2cc 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

.collapse-toggle-btn.expanded i {
    transform: rotate(0deg); /* Chevron-down thẳng */
}

/* Children count khi tất cả children đã completed */
.children-count.all-completed {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    /* border: 2px solid transparent; */
}

.children-count.all-completed.expanded {
    background: transparent;
    color: #4CAF50;
    border: 2px solid #4CAF50;
}

.children-count.all-completed:hover {
    transform: scale(1.1);
}

.children-count.all-completed.expanded:hover {
    background: rgba(76, 175, 80, 0.1);
    border-color: #388E3C;
}

.children-count.all-completed.collapsed:hover {
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.4);
}

/* Children count khi có một phần hoàn thành (tỷ lệ x/y) */
.children-count.partial-completed {
    background: linear-gradient(135deg, #F8BBD9 0%, #F48FB1 100%);
    color: #AD1457;
    /* border: 2px solid transparent; */
}

.children-count.partial-completed.expanded {
    background: transparent;
    color: #E91E63;
    border: 2px solid #F8BBD9;
}

.children-count.partial-completed:hover {
    transform: scale(1.1);
}

.children-count.partial-completed.expanded:hover {
    background: rgba(248, 187, 217, 0.2);
    border-color: #F48FB1;
}

.children-count.partial-completed.collapsed:hover {
    box-shadow: 0 4px 8px rgba(248, 187, 217, 0.5);
}

.todo-text.completed {
    text-decoration: line-through;
    color: #999;
    opacity: 0.7;
}

.todo-text.skipped {
    text-decoration: line-through;
    color: #999;
    opacity: 0.7;
}

/* Checkbox khi tất cả children đã hoàn thành */
.todo-checkbox.all-children-completed:hover {
    border-color: #4CAF50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.4);
}

.todo-checkbox.all-children-completed.completed {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%) !important;
    border-color: #4CAF50 !important;
    color: white;
}

.todo-checkbox.all-children-completed.completed:hover {
    background: linear-gradient(135deg, #45a049 0%, #388E3C 100%) !important;
    border-color: #388E3C !important;
}

/* Checkbox cho leaf node (todo con cuối cùng) - sử dụng màu tím */
.todo-checkbox.leaf-node.completed {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
}

.todo-checkbox.leaf-node.completed:hover {
    background: linear-gradient(135deg, #764ba2 0%, #5a67d8 100%);
    border-color: #5a67d8;
}





/* Hide children-count in parent selection mode */
.parent-selection-mode .children-count {
    display: none !important;
}

/* Hide children-count in move selection mode */
.move-selection-mode .children-count {
    display: none !important;
}




.action-btn {
    border: none;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.add-sub-btn {
    background: #4CAF50;
    color: white;
}

.add-sub-btn:hover {
    background: #45a049;
    transform: scale(1.05);
}

.edit-btn {
    background: #2196F3;
    color: white;
}

.edit-btn:hover {
    background: #1976D2;
    transform: scale(1.05);
}

.set-parent-btn {
    background: #9C27B0;
    color: white;
}

.set-parent-btn:hover {
    background: #7B1FA2;
    transform: scale(1.05);
}

.make-root-btn {
    background: #FF9800;
    color: white;
}

.make-root-btn:hover:not(:disabled) {
    background: #F57C00;
    transform: scale(1.05);
}

.make-root-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.5;
}

.duplicate-btn {
    background: #17a2b8;
    color: white;
}

.duplicate-btn:hover {
    background: #138496;
    transform: scale(1.05);
}

.set-priority-btn {
    background: #dc3545;
    color: white;
}

.set-priority-btn:hover {
    background: #c82333;
    transform: scale(1.05);
}

.time-block-btn {
    background: #28a745;
    color: white;
}

.time-block-btn:hover {
    background: #218838;
    transform: scale(1.05);
}

.skip-btn {
    background: #ff9800;
    color: white;
}

.skip-btn:hover {
    background: #f57c00;
    transform: scale(1.05);
}






.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
    transform: translateY(-1px);
}


/* Parent Selection Effects */
.parent-selection-available {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(76, 175, 80, 0.05)) !important;
    cursor: pointer !important;
}

.parent-selection-available:hover {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.2), rgba(76, 175, 80, 0.1)) !important;
}

.parent-selection-available::after {
    content: "Nhấn để chọn làm cha";
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: #4CAF50;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    z-index: 1001;
    opacity: 0;
    white-space: nowrap;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.parent-selection-available:hover::after {
    opacity: 0.9;
}

.parent-selection-child {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.1), rgba(255, 152, 0, 0.05)) !important;
    border: 1px solid transparent !important;
    border-radius: 8px !important;
    opacity: 0.7 !important;
}

.parent-selection-child::after {
    content: "Todo đang chọn";
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: #FF9800;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    z-index: 1001;
    opacity: 0;
    white-space: nowrap;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.parent-selection-child:hover::after {
    opacity: 0.9;
}

.parent-selection-descendant {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.1), rgba(244, 67, 54, 0.05)) !important;
    border: 1px solid transparent !important;
    border-radius: 8px !important;
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

.parent-selection-descendant::after {
    content: "Không thể chọn con/cháu";
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: #F44336;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    z-index: 1001;
    opacity: 0;
    white-space: nowrap;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.parent-selection-descendant:hover::after {
    opacity: 0.9;
}

/* Project Parent Selection Effects */
.project-selection-available {
    background: linear-gradient(135deg, rgba(63, 81, 181, 0.15), rgba(63, 81, 181, 0.08)) !important;
    cursor: pointer !important;
    border: 2px solid rgba(63, 81, 181, 0.3) !important;
    border-radius: 8px !important;
    transform: scale(1.02);
    transition: all 0.3s ease;
    position: relative;
}

/* Đảm bảo click event hoạt động trên toàn bộ project header */
.project-selection-available .project-header-content {
    pointer-events: none;
}

.project-selection-available .project-title-small {
    pointer-events: none;
}

.project-selection-available .project-header-bottom > * {
    pointer-events: none !important;
}

.project-selection-available:hover {
    background: linear-gradient(135deg, rgba(63, 81, 181, 0.25), rgba(63, 81, 181, 0.15)) !important;
    border: 2px solid rgba(63, 81, 181, 0.5) !important;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(63, 81, 181, 0.3);
}

.project-selection-available::after {
    content: "📁 Nhấn để chọn Project làm Cha";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(63, 81, 181, 0.95);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    z-index: 1000;
    opacity: 0;
    white-space: nowrap;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.project-selection-available:hover::after {
    opacity: 1;
}

/* Body class for parent selection mode - áp dụng cho cả todo và project selection */
.parent-selection-mode .project-header-small.project-selection-available {
    position: relative;
}

.parent-selection-mode .project-header-small:not(.project-selection-available) {
    opacity: 0.7;
    filter: grayscale(0.2);
}


/* Move Selection Effects */
.move-selection-available {
    position: relative;
}

.move-selection-selected {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.2), rgba(255, 193, 7, 0.1)) !important;
    border: 1px solid rgba(255, 193, 7, 0.3) !important;
    border-radius: 8px !important;
    opacity: 0.7 !important;
}

.move-selection-selected::after {
    content: "Todo đang di chuyển";
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: #ffc107;
    color: #212529;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    z-index: 1001;
    opacity: 0;
    white-space: nowrap;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.move-selection-selected:hover::after {
    opacity: 0.9;
}

.move-selection-unavailable {
    background: linear-gradient(135deg, rgba(108, 117, 125, 0.1), rgba(108, 117, 125, 0.05)) !important;
    border: 1px solid transparent !important;
    border-radius: 8px !important;
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

.move-selection-unavailable::after {
    content: "Không cùng mức";
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: #6c757d;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    z-index: 1001;
    opacity: 0;
    white-space: nowrap;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.move-selection-unavailable:hover::after {
    opacity: 0.9;
}

/* Move Slots (Khe chèn) */
.move-slot {
    height: 12px;
    margin: 6px 0;
    border-radius: 2px;
    background: rgba(0, 123, 255, 0.4);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.move-selection-mode .move-slot {
    opacity: 1;
}

.move-slot:active {
    transform: scale(0.95);
    background: linear-gradient(135deg, #007bff, #0056b3);
    box-shadow: 0 1px 3px rgba(0, 123, 255, 0.4);
}

/* Tạo thanh ngang mảnh bằng pseudo-element */
.move-slot::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 2px;
    background: rgba(0, 123, 255, 0.8);
    border-radius: 1px;
    z-index: 1;
}

.move-slot::after {
    content: "Chèn vào đây";
    background: rgba(0, 123, 255, 0.95);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    z-index: 2;
}



.delete-btn {
    background: #ff4757;
    color: white;
}

.delete-btn:hover {
    background: #ff3742;
    transform: scale(1.05);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 30px;
    color: #999;
    display: none;
    cursor: pointer;
}

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

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #ddd;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #666;
}

.help-section {
    margin-top: 30px;
    text-align: left;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.help-section h4 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.help-section ul {
    list-style: none;
    padding: 0;
}

.help-section li {
    margin-bottom: 8px;
    padding: 8px 12px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.help-section strong {
    color: #667eea;
}


/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 0; /* Loại bỏ padding trên mobile */
        margin: 0;
    }
    
    .container {
        width: 100vw; /* Chiếm hết viewport width */
        height: 100vh; /* Chiếm hết viewport height */
        margin: 0;
        padding: 0;
    }
    
    .todo-app {
        width: 100vw; /* Chiếm hết viewport width */
        height: 100vh; /* Chiếm hết viewport height */
        margin: 0;
        padding: 0;
    }
    
    .login-screen {
        width: 100vw; /* Chiếm hết viewport width */
        height: 100vh; /* Chiếm hết viewport height */
        margin: 0;
        padding: 0;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .filter-section {
        padding: 10px 15px; /* Giữ padding cho filter section */
        border-radius: 0; /* Loại bỏ border radius trên mobile */
        flex-direction: column;
        gap: 10px;
    }
    
    .left-section {
        order: 1;
        width: 100%;
        justify-content: center;
        max-width: none;
    }

    .right-section {
        order: 2;
        width: 100%;
        justify-content: center;
        max-width: none;
    }
    
    .multi-project-container {
        gap: 15px;
        padding: 15px; /* Giữ padding cho project container */
        border-radius: 0; /* Loại bỏ border radius trên mobile */
        scroll-snap-type: x mandatory; /* Thêm scroll snap cho mobile */
    }
    
    .project-column {
        min-width: 85vw;
        max-width: 90vw;
        width: 87.5vw; /* Chiếm 87.5% viewport width */
    }
    
    .filter-section {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .current-datetime {
        order: 0;
        align-self: center;
        font-size: 0.8rem;
        padding: 10px 12px;
    }
    
    .search-container {
        max-width: none;
        order: 1;
    }
    
    .filter-section .filter-buttons {
        order: 2;
        justify-content: center;
    }
    
    
    .filter-section .create-project-btn {
        order: 4;
        align-self: center;
    }
    
    
    
    .filter-section .top-right-controls {
        order: 7;
        align-self: center;
        margin-left: 0;
    }
    
    .filter-buttons {
        justify-content: center;
        margin-bottom: 10px;
    }
    
    .stats {
        text-align: center;
    }
    
    .todo-item:hover {
        background: rgba(102, 126, 234, 0.05);
    }
    
    .todo-actions {
        gap: 3px;
        padding: 3px 6px;
    }
    
    .children-count {
        margin-right: 8px;
        font-size: 0.7rem;
        padding: 3px 6px;
        min-width: 18px;
    }
    
    .action-btn {
        min-width: 24px;
        height: 24px;
        font-size: 0.7rem;
        padding: 4px 6px;
    }
    
    .todo-item {
        --indent-size: 20px;
    }
    
    .todo-item[class*="level-"] {
        border-left-width: 2px;
    }
}

@media (max-width: 480px) {
    .container {
        width: 100vw;
        height: 100vh;
    }
    
    .todo-app {
        width: 100vw;
        height: 100vh;
    }
    
    .login-screen {
        width: 100vw;
        height: 100vh;
    }
    
    .multi-project-container {
        gap: 10px;
        padding: 10px;
    }
    
    .project-column {
        min-width: 85vw;
        max-width: 90vw;
        width: 87.5vw; /* Chiếm 87.5% viewport width */
    }
    
    .project-header-small {
        padding: 12px 15px;
        min-height: 50px;
    }
    
    .project-actions {
        gap: 4px;
    }
    
    .project-action-btn {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
    }
    
    .add-todo-btn {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
    
    .project-category-display {
        height: 28px;
        font-size: 0.75rem;
        padding: 4px 10px;
    }
    
    .project-title-small {
        font-size: 1rem;
    }
    
    .project-todo-count-small {
        font-size: 0.7rem;
        padding: 3px 6px;
    }
    
    .todo-actions {
        flex-wrap: wrap;
        gap: 2px;
    }
    
    .action-btn {
        min-width: 22px;
        height: 22px;
        font-size: 0.6rem;
    }
    
    .todo-text {
        font-size: 0.9rem;
    }
    
    .children-count {
        font-size: 0.65rem;
        padding: 2px 5px;
        min-width: 16px;
        margin-right: 6px;
    }
    
    .auto-backup-info {
        padding: 8px 12px;
        margin: 6px 8px;
    }
    
    .auto-backup-info span {
        font-size: 0.8rem;
    }
    
    .auto-backup-info small {
        font-size: 0.7rem;
    }
    
    .current-datetime {
        font-size: 0.75rem;
        padding: 8px 10px;
        flex-direction: column;
        gap: 2px;
        text-align: center;
    }
    
    .current-datetime span {
        font-size: 0.7rem;
        line-height: 1.2;
    }
}

/* Custom Scrollbar */
.todo-list::-webkit-scrollbar {
    width: 6px;
}

.todo-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.todo-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.todo-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Custom Context Menu */
.custom-context-menu {
    position: fixed;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 0;
    min-width: 280px; /* Mở rộng width để chứa 6 nút */
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9) translateY(-10px);
    transition: all 0.2s ease;
    pointer-events: none;
}

/* Mobile Bottom Sheet Context Menu */
@media (max-width: 768px) {
    .custom-context-menu {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100vw;
        min-width: auto;
        max-width: none;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3);
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 20px 0 40px 0; /* Thêm padding bottom cho safe area */
    }
    
    .custom-context-menu.show {
        transform: translateY(0);
    }
    
    /* Swipe dismiss states */
    .custom-context-menu.swiping {
        transition: none; /* Disable transition khi đang swipe */
        will-change: transform; /* Optimize cho animation */
    }
    
    .custom-context-menu.dismissing {
        transition: transform 0.4s cubic-bezier(0.55, 0.055, 0.675, 0.19);
        will-change: transform;
    }
    
    /* Smooth backdrop transition */
    .context-menu-backdrop.swiping {
        transition: opacity 0.1s ease;
    }
    
    /* Backdrop overlay cho mobile */
    .context-menu-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .context-menu-backdrop.show {
        opacity: 1;
        visibility: visible;
    }
    
    /* Context menu items cho mobile */
    .context-menu-item {
        padding: 16px 20px;
        font-size: 1rem;
        border-radius: 0;
        margin: 0 16px;
        border-radius: 12px;
    }
    
    .context-menu-item:active {
        background: rgba(102, 126, 234, 0.1);
        transform: scale(0.98);
    }
    
    /* Handle bar cho bottom sheet */
    .context-menu-handle {
        width: 40px;
        height: 4px;
        background: #bbb;
        border-radius: 2px;
        margin: 12px auto 16px auto;
        opacity: 0.8;
        cursor: grab;
        position: relative;
    }
    
    .context-menu-handle::before {
        content: '';
        position: absolute;
        top: -8px;
        left: -8px;
        right: -8px;
        bottom: -8px;
        /* Invisible touch area để dễ grab hơn */
    }
    
    /* Double-tap visual feedback */
    .double-tap-feedback {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 60px;
        height: 60px;
        border-radius: 50%;
        background: rgba(102, 126, 234, 0.3);
        pointer-events: none;
        animation: doubleTapRipple 0.6s ease-out;
        z-index: 1000;
    }
    
    @keyframes doubleTapRipple {
        0% {
            transform: translate(-50%, -50%) scale(0.3);
            opacity: 1;
        }
        100% {
            transform: translate(-50%, -50%) scale(2);
            opacity: 0;
        }
    }
    
    /* Mobile double-tap hint */
    .mobile-hint {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0, 0, 0, 0.8);
        color: white;
        padding: 8px 16px;
        border-radius: 20px;
        font-size: 0.8rem;
        z-index: 9998;
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
    }
    
    .mobile-hint.show {
        opacity: 1;
    }
}

.custom-context-menu.show {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #333;
    font-size: 0.9rem;
    font-weight: 500;
}

.context-menu-item:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(102, 126, 234, 0.05));
    color: #667eea;
}

.context-menu-item i {
    width: 16px;
    text-align: center;
    font-size: 0.85rem;
}

.context-menu-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 4px 0;
}

/* Context menu item specific colors */
.context-menu-item:has(.fa-check):hover {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(76, 175, 80, 0.05));
    color: #4CAF50;
}

.context-menu-item:has(.fa-undo):hover {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.1), rgba(255, 152, 0, 0.05));
    color: #FF9800;
}

.context-menu-item:has(.fa-edit):hover {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.1), rgba(33, 150, 243, 0.05));
    color: #2196F3;
}

.context-menu-item:has(.fa-plus):hover {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(76, 175, 80, 0.05));
    color: #4CAF50;
}

.context-menu-item:has(.fa-arrow-up):hover {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(76, 175, 80, 0.05));
    color: #4CAF50;
}

.context-menu-item:has(.fa-arrow-down):hover {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.1), rgba(33, 150, 243, 0.05));
    color: #2196F3;
}

.context-menu-item:has(.fa-copy):hover {
    background: linear-gradient(135deg, rgba(23, 162, 184, 0.1), rgba(23, 162, 184, 0.05));
    color: #17a2b8;
}

.context-menu-item:has(.fa-trash):hover {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.1), rgba(244, 67, 54, 0.05));
    color: #F44336;
}

.context-menu-item:has(.fa-folder-plus):hover {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.1), rgba(156, 39, 176, 0.05));
    color: #9C27B0;
}

.context-menu-item:has(.fa-sync-alt):hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(102, 126, 234, 0.05));
    color: #667eea;
}

.context-menu-item:has(.fa-exclamation):hover {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1), rgba(220, 53, 69, 0.05));
    color: #dc3545;
}

.context-menu-item:has(.fa-level-up-alt):hover {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.1), rgba(156, 39, 176, 0.05));
    color: #9C27B0;
}

.context-menu-item:has(.fa-home):hover {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.1), rgba(255, 152, 0, 0.05));
    color: #FF9800;
}

.context-menu-item:has(.fa-trash-restore):hover {
    background: linear-gradient(135deg, rgba(255, 87, 34, 0.1), rgba(255, 87, 34, 0.05));
    color: #FF5722;
}

.context-menu-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: #999;
}

.context-menu-item.disabled:hover {
    background: none;
    color: #999;
}

/* Context Menu Time Blocks */
.context-menu-time-blocks {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    justify-content: space-between;
    align-items: center;
}

.context-time-btn, .context-skip-btn {
    flex: 1;
    min-width: 32px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.context-time-btn:hover {
    background: rgba(76, 175, 80, 0.2);
    transform: translateY(-1px);
}

.context-skip-btn {
    background: rgba(255, 152, 0, 0.1);
    color: #ff9800;
}

.context-skip-btn:hover {
    background: rgba(255, 152, 0, 0.2);
    transform: translateY(-1px);
}

/* Legacy Modal Overlay - Deprecated */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    animation: modalFadeIn 0.3s ease forwards;
}

.modal-overlay.closing {
    animation: modalFadeOut 0.3s ease forwards;
}

@keyframes modalFadeIn {
    to {
        opacity: 1;
    }
}

@keyframes modalFadeOut {
    to {
        opacity: 0;
    }
}

/* Legacy Modal - Deprecated */
.modal-overlay .modal {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #333;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    animation: modalSlideIn 0.3s ease forwards;
}

.modal-overlay.closing .modal {
    animation: modalSlideOut 0.3s ease forwards;
}

@keyframes modalSlideIn {
    to {
        transform: scale(1) translateY(0);
    }
}

@keyframes modalSlideOut {
    to {
        transform: scale(0.9) translateY(20px);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: white;
    border-radius: 16px 16px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #495057;
}

.modal-close-btn {
    background: none;
    border: none;
    color: #6c757d;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    opacity: 1;
    transform: scale(1.1);
    color: #495057;
}

.modal-close-btn i {
    display: block;
    line-height: 1;
    transform-origin: center;
}

.modal-body {
    padding: 24px;
    background: white;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    background: white;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-radius: 0 0 16px 16px;
}


/* Archived Projects Modal */
.archived-projects-modal {
    max-width: 600px;
    max-height: 80vh;
}

.archived-projects-modal .modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

.archived-projects-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Custom scrollbar for modal */
.archived-projects-modal .modal-body::-webkit-scrollbar {
    width: 8px;
}

.archived-projects-modal .modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.archived-projects-modal .modal-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.archived-projects-modal .modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

.archived-project-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@media (max-width: 576px) {
    .archived-project-item {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .archived-project-actions {
        justify-content: stretch;
    }
}

.archived-project-item:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.archived-project-info h4 {
    margin: 0 0 8px 0;
    color: #495057;
    font-size: 1.1rem;
    font-weight: 600;
}

.archived-project-stats {
    margin: 0 0 4px 0;
    color: #6c757d;
    font-size: 0.9rem;
}

.archived-date {
    margin: 0;
    color: #868e96;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.archived-project-actions {
    display: flex;
    gap: 8px;
}

.btn-restore, .btn-delete {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-restore {
    background: #28a745;
    color: white;
    border: 1px solid #28a745;
}

.btn-restore:hover {
    background: #218838;
    border-color: #1e7e34;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.btn-delete {
    background: #dc3545;
    color: white;
    border: 1px solid #dc3545;
}

.btn-delete:hover {
    background: #c82333;
    border-color: #bd2130;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

/* Modal Backdrop */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-backdrop.show {
    opacity: 1;
}

/* Modal Base Styles - New Modal System */
.modal:not(.modal-overlay .modal) {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) scale(0.8) !important;
    background: white !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
    z-index: 10000 !important;
    max-height: 80vh !important;
    overflow: hidden !important;
    opacity: 0 !important;
    transition: all 0.3s ease !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    height: auto !important;
}

.modal:not(.modal-overlay .modal).show {
    opacity: 1 !important;
    transform: translate(-50%, -50%) scale(1) !important;
}

/* Đảm bảo modal luôn căn giữa hoàn hảo */
.modal,
.project-settings-modal,
.category-management-modal {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

/* Reset các style có thể gây conflict */
.modal *,
.project-settings-modal *,
.category-management-modal * {
    box-sizing: border-box;
}

/* Modal Sizes */
.modal:not(.modal-overlay .modal).modal-small {
    max-width: 400px !important;
    width: min(90vw, 400px) !important;
}

.modal:not(.modal-overlay .modal).modal-medium {
    max-width: 500px !important;
    width: min(90vw, 500px) !important;
}

.modal:not(.modal-overlay .modal).modal-large {
    max-width: 800px !important;
    width: min(95vw, 800px) !important;
}

.modal:not(.modal-overlay .modal).modal-full {
    max-width: 1000px !important;
    width: min(95vw, 1000px) !important;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: #e9ecef;
    color: #333;
    transform: scale(1.1);
}

/* Modal Body Component */
.modal-body {
    padding: 24px;
    background: white;
    flex: 1;
    overflow-y: auto;
}

/* Modal Footer Component */
.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    border-radius: 0 0 16px 16px;
}

/* Form Components */
.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s ease;
    box-sizing: border-box;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-group input::placeholder {
    color: #6c757d;
    font-size: 14px;
}

/* Button Components */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    min-width: 80px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* Special Components */
.scheduled-time {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    color: #495057;
    font-weight: 500;
}

.scheduled-time i {
    color: #007bff;
}

/* Project Settings Modal */
.project-settings-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.project-settings-modal.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.project-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.project-settings-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #e9ecef;
    color: #333;
    transform: scale(1.1);
}

.project-settings-content {
    padding: 24px;
}

/* Project Settings Specific Styles */
.project-name-section {
    margin-bottom: 24px;
}

.project-name-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.project-name-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.project-name-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.color-section {
    margin-bottom: 24px;
}

.color-section label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

/* Legacy modal actions - use new button components */
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
}

.btn-save {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 80px;
}

.btn-save:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.btn-cancel {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 80px;
}

.btn-cancel:hover {
    background: #545b62;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.color-option {
    position: relative;
    height: 80px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    overflow: hidden;
}

.color-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.color-option.selected {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.color-name {
    color: white;
    font-weight: 600;
    font-size: 14px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.color-option i.fa-check {
    position: absolute;
    top: 8px;
    right: 8px;
    color: white;
    font-size: 16px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    z-index: 2;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .modal:not(.modal-overlay .modal) {
        width: 95vw !important;
        max-width: 95vw !important;
        max-height: 90vh !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .modal:not(.modal-overlay .modal).modal-small {
        width: 90vw !important;
        max-width: 90vw !important;
    }
    
    .modal:not(.modal-overlay .modal).modal-medium {
        width: 95vw !important;
        max-width: 95vw !important;
    }
    
    .modal:not(.modal-overlay .modal).modal-large,
    .modal:not(.modal-overlay .modal).modal-full {
        width: 98vw !important;
        max-width: 98vw !important;
    }
    
    .color-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .color-option {
        height: 70px;
    }
    
    .color-name {
        font-size: 13px;
    }
    
    .modal-actions,
    .modal-footer {
        flex-direction: column;
    }
    
    .btn-save, .btn-cancel,
    .btn-primary, .btn-secondary {
        width: 100%;
    }
    
    .form-group {
        margin-bottom: 16px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px 14px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .category-management-content {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* Char Counter Styles */
.char-counter {
    font-size: 12px;
    color: #666;
    text-align: right;
    margin-top: 4px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.char-counter.warning {
    color: #ff9800;
}

.char-counter.danger {
    color: #f44336;
}

/* Form Styles for Modal */
.add-todo-form .form-group {
    margin-bottom: 16px;
}

.add-todo-form .form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.add-todo-form .readonly-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #f8f9fa;
    color: #666;
    font-size: 14px;
    cursor: not-allowed;
}

.add-todo-form .form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: white;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.add-todo-form .form-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.add-todo-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: Arial, sans-serif;
    resize: vertical;
    min-height: 60px;
    max-height: 120px;
    transition: border-color 0.2s ease;
}

.add-todo-form textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

/* Edit todo form styles */
.edit-todo-form .form-group {
    margin-bottom: 16px;
}

.edit-todo-form .form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.edit-todo-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: Arial, sans-serif;
    resize: vertical;
    min-height: 60px;
    max-height: 120px;
    transition: border-color 0.2s ease;
}

.edit-todo-form textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.todo-item.highlight-todo {
    animation: todoHighlight 2s ease;
    border-color: #ffc107;
}

@keyframes todoHighlight {
    0% {
        box-shadow: 0 0 0 rgba(255, 193, 7, 0.7);
    }
    50% {
        box-shadow: 0 0 18px rgba(255, 193, 7, 0.9);
    }
    100% {
        box-shadow: 0 0 0 rgba(255, 193, 7, 0);
    }
}