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

body::-webkit-scrollbar {
    display: none; /* For Chrome, Edge, Safari */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e1e2e 0%, #2a2a3e 100%);
    scroll-behavior: smooth;
    min-height: 100vh;
    color: #e5e5e5;
    overflow-x: hidden;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
}

.header-logo {
    height: 1.2em; /* This makes the logo scale with the h1 font size */
    width: auto; /* Maintains aspect ratio */
    vertical-align: middle; /* Aligns with the text baseline */
    display: inline-block;
}

.header h1 {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    animation: fadeInUp 1s ease-out;
    display: flex;
    align-items: center; /* Centers logo and text vertically */
    justify-content: center;
    gap: 10px; /* Space between logo and text */

}

.header p {
    font-size: 1.2rem;
    color: #a0a0a0;
    animation: fadeInUp 1s ease-out 0.2s both;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
    animation: fadeInUp 1s ease-out 0.4s both;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.stat-card:hover::before {
    left: 100%;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: rgba(102, 126, 234, 0.5);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 1rem;
    color: #a0a0a0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.input-container {
    margin-bottom: 40px;
    animation: fadeInUp 1s ease-out 0.6s both;
}

.form-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 12px 25px;
    color: #a0a0a0;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn.active,
.tab-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.input-form {
    display: none;
}

.input-form.active {
    display: block;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    padding: 20px;
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.3);
}

.input-row {
    display: flex;
    gap: 15px;
    align-items: center;
}

.input-field {
    flex: 1;
    background: transparent;
    border: none;
    padding: 18px 25px;
    font-size: 1.1rem;
    color: #e5e5e5;
    outline: none;
}

.input-field::placeholder {
    color: #666;
}

/* Custom Date Picker Styles */
.custom-date-picker {
    position: relative;
    display: inline-block;
}

.date-trigger {
    width: 44px;                /* square button */
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;               /* icon color */
    cursor: pointer;
    font-size: 20px;            /* adjust icon size */
    margin-left: auto; 
}

.date-trigger span {
    display: none; /* hide the "Select deadline (optional)" text */
}

.date-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.date-trigger.has-date {
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
}

.date-icon {
    color: #ffffff;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.date-text {
    flex: 1;
    font-size: 1rem;
    color: #e5e5e5;
    text-align: left;
}

.date-text.placeholder {
    color: #888;
}

.dropdown-arrow {
    color: #667eea;
    font-size: 0.9rem;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.dropdown-arrow.open {
    transform: rotate(180deg);
}

/* Calendar Dropdown - Fixed to be opaque */
/* Fix desktop calendar clipping */
.calendar-dropdown {
    position: fixed; /* instead of absolute */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 350px;
    background: #1e1e2e;
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.9);
    z-index: 2000; /* higher than input wrapper */
    opacity: 0;
    pointer-events: none;
}

.calendar-dropdown.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: all;
}


.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: #2a2a3e;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    width: 35px;
    height: 35px;
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: scale(1.1);
}

.month-year {
    font-size: 1rem;
    font-weight: 600;
    color: #e5e5e5;
}

.calendar-grid {
    padding: 15px 20px;
    background: #1e1e2e;
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    margin-bottom: 8px;
}

.weekday {
    text-align: center;
    font-size: 0.75rem;
    color: #888;
    font-weight: 600;
    padding: 6px 0;
}

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

.day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    position: relative;
    overflow: hidden;
    min-height: 32px;
    background: rgba(255, 255, 255, 0.05);
}

.day:not(.disabled):hover {
    background: rgba(102, 126, 234, 0.2);
    transform: scale(1.05);
}

.day.other-month {
    color: #555;
    background: rgba(255, 255, 255, 0.02);
}

.day.today {
    background: rgba(255, 193, 7, 0.3);
    color: #ffc107;
    font-weight: bold;
    border: 2px solid #ffc107;
}

.day.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.day.disabled {
    color: #333;
    cursor: not-allowed;
    opacity: 0.3;
    background: rgba(255, 255, 255, 0.01);
}





.add-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 20px;
    padding: 18px 30px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    align-self: flex-end;
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

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

.filter-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    animation: fadeInUp 1s ease-out 0.8s both;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    padding: 12px 25px;
    color: #a0a0a0;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.filter-btn.active,
.filter-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    flex: 1;
    animation: fadeInUp 1s ease-out 1s both;
}

.section {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 25px;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.section-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #e5e5e5;
}

.section-icon {
    font-size: 1.2rem;
    color: #667eea;
}

.todos-container {
    min-height: 400px;
}

.todo-item {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
    position: relative;
    animation: slideInUp 0.5s ease-out;
}

.todo-item.overdue {
    border-color: rgba(220, 53, 69, 0.5);
    background: rgba(220, 53, 69, 0.05);
}

.todo-item.due-today {
    border-color: rgba(255, 193, 7, 0.5);
    background: rgba(255, 193, 7, 0.05);
}

.todo-item.reminder-item {
    border-color: rgba(40, 167, 69, 0.5);
    background: rgba(40, 167, 69, 0.05);
}

.todo-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.todo-text {
    font-size: 1.1rem;
    color: #e5e5e5;
    font-weight: 500;
    line-height: 1.5;
}

.todo-deadline {
    font-size: 0.9rem;
    color: #888;
    display: flex;
    align-items: center;
    gap: 5px;
}

.todo-deadline.overdue {
    color: #dc3545;
}

.todo-deadline.due-today {
    color: #ffc107;
}

.todo-deadline.due-soon {
    color: #fd7e14;
}

.todo-item::before {
    display: none;
}

.todo-item:hover::before {
    left: 100%;
}

.todo-item:hover {
    transform: translateX(10px);
    border-color: rgba(102, 126, 234, 0.5);
}

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

.todo-item.completed .todo-text {
    color: #888;
}

.custom-checkbox {
    position: relative;
    width: 25px;
    height: 25px;
    cursor: pointer;
}

.custom-checkbox input {
    opacity: 0;
    position: absolute;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    width: 25px;
    height: 25px;
    background: transparent;
    border: 2px solid #667eea;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.custom-checkbox input:checked + .checkmark {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: scale(1.1);
}

.checkmark::after {
    content: '';
    position: absolute;
    display: none;
    left: 7px;
    top: 3px;
    width: 7px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.custom-checkbox input:checked + .checkmark::after {
    display: block;
}

.action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 10px;
    padding: 10px;
    color: #a0a0a0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.save-btn:hover {
    background: rgba(40, 167, 69, 0.2);
    color: #28a745;
    transform: scale(1.1);
}

.cancel-btn:hover {
    background: rgba(108, 117, 125, 0.2);
    color: #6c757d;
    transform: scale(1.1);
}

.edit-btn:hover {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    transform: scale(1.1);
}

.delete-btn:hover {
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
    transform: scale(1.1);
}

.edit-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #667eea;
    border-radius: 10px;
    padding: 10px 15px;
    font-size: 1.1rem;
    color: #e5e5e5;
    outline: none;
}

/* Edit Mode Custom Date Picker */
.edit-date-picker {
    margin-top: 10px;
    position: relative;
}

.edit-custom-date-picker {
    position: relative;
    width: 100%;
}

.edit-date-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #667eea;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 150px;
    font-size: 0.9rem;
}

.edit-date-trigger:hover {
    background: rgba(102, 126, 234, 0.15);
    transform: translateY(-1px);
}

.edit-date-trigger.has-date {
    background: rgba(102, 126, 234, 0.2);
}

.edit-date-text {
    flex: 1;
    color: #e5e5e5;
    font-size: 0.85rem;
}

.edit-date-text.placeholder {
    color: #888;
}

.edit-dropdown-arrow {
    color: #667eea;
    font-size: 0.7rem;
    transition: transform 0.3s ease;
}

.edit-dropdown-arrow.open {
    transform: rotate(180deg);
}

/* Edit Calendar Dropdown - Fixed to be opaque */
.edit-calendar-dropdown {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 300px;
    background: #1e1e2e;
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.8);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.edit-calendar-dropdown.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: all;
}

.edit-calendar-dropdown .calendar-header {
    padding: 12px 15px;
    background: #2a2a3e;
}

.edit-calendar-dropdown .calendar-grid {
    padding: 12px 15px;
    background: #1e1e2e;
}

.edit-calendar-dropdown  {
    padding: 10px 15px;
    background: #2a2a3e;
}

.edit-calendar-dropdown {
    padding: 4px 8px;
    font-size: 0.7rem;
}

.edit-calendar-dropdown .day {
    min-height: 28px;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
}

.edit-calendar-dropdown .day:not(.disabled):hover {
    background: rgba(102, 126, 234, 0.2);
}

.edit-calendar-dropdown .day.other-month {
    background: rgba(255, 255, 255, 0.02);
}

.edit-calendar-dropdown .day.today {
    background: rgba(255, 193, 7, 0.3);
}

.edit-calendar-dropdown .day.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.edit-calendar-dropdown .day.disabled {
    background: rgba(255, 255, 255, 0.01);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

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

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

.empty-state p {
    font-size: 1rem;
    color: #666;
}

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

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

.todo-actions {
    display: flex;
    gap: 10px;
}

/* Scroll Spy Styles */
.scroll-spy {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    z-index: 100;
}

.spy-track {
    width: 4px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.spy-progress {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 0%;
    transition: height 0.3s ease;
    border-radius: 2px;
}

/* Auth Controls */
#authControls {
    position: absolute;
    top: 20px;
    right: 30px;
    display: flex;
    gap: 12px;
    z-index: 200;
}

#authControls button {
    border-radius: 18px;
    padding: 12px 22px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
}

#loginBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

#loginBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

#logoutBtn {
    background: #444;
    color: #e5e5e5;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#logoutBtn:hover {
    background: #555;
    color: #fff;
}

/* Touch-friendly interactions */
@media (hover: none) and (pointer: coarse) {
    .action-btn, .filter-btn, .tab-btn, .add-btn, .date-trigger, .nav-btn {
        min-height: 44px;
        min-width: 44px;
        padding: 12px;
    }
    
    .todo-item:hover {
        transform: none;
    }
    
    .stat-card:hover {
        transform: none;
    }
    
    .cursor, #cursorCircle, .scroll-spy {
        display: none !important;
    }
}

/* Mobile responsive updates for custom calendar */
@media (max-width: 768px) {
    .container {
        padding: 12px;
        width: 100%;
        max-width: 100vw;
    }
    
    .header {
        margin-bottom: 25px;
        padding: 20px 0;
        position: relative;
    }
    
    .header h1 {
        font-size: 2.2rem;
        margin-bottom: 8px;
    }
    
    .header p {
        font-size: 0.95rem;
    }
    
    #authControls {
        position: static;
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        margin-top: 15px;
        gap: 10px;
    }
    
    #authControls button {
        font-size: 0.85rem;
        padding: 10px 16px;
        border-radius: 12px;
    }
    
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 25px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-number {
        font-size: 1.8rem;
    }
    
    .stat-label {
        font-size: 0.85rem;
    }
    
    .input-container {
        margin-bottom: 25px;
    }
    
    .form-tabs {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
        margin-top: 70px;
    }
    
    .tab-btn {
        padding: 10px 18px;
        font-size: 0.85rem;
        border-radius: 12px;
    }
    
    .input-wrapper {
        padding: 16px;
        border-radius: 20px;
    }
    
    .input-row {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .input-field {
        padding: 14px 20px;
        font-size: 1rem;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .date-trigger {
        padding: 12px 16px;
    }
    
    .add-btn {
        width: 100%;
        align-self: stretch;
        padding: 16px;
        font-size: 0.95rem;
        border-radius: 16px;
        margin-top: 8px;
    }
    
    .filter-container {
        gap: 8px;
        flex-wrap: wrap;
        margin-bottom: 20px;
    }
    
    .filter-btn {
        padding: 10px 18px;
        font-size: 0.8rem;
        border-radius: 20px;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-top: 70px;
    }
    
    .section {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 16px;
        box-sizing: border-box;
        border-radius: 20px;
    }
    
    .section-header {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }
    
    .section-title {
        font-size: 1.1rem;
    }
    
    .todo-item, .reminder-item {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: 16px;
        gap: 12px;
        border-radius: 16px;
        margin-bottom: 12px;
    }
    
    .todo-content {
        width: 100%;
        order: 2;
    }
    
    .custom-checkbox {
        order: 1;
        align-self: flex-start;
    }
    
    .todo-actions {
        width: 100%;
        display: flex;
        justify-content: flex-end;
        gap: 8px;
        order: 3;
    }
    
    .todo-text {
        font-size: 1rem;
        word-break: break-word;
        line-height: 1.4;
    }
    
    .todo-deadline {
        font-size: 0.85rem;
        margin-top: 6px;
    }
    
    .edit-input {
        width: 100%;
        padding: 12px 16px;
        font-size: 1rem;
        border-radius: 12px;
        margin-bottom: 8px;
    }
    
    .edit-date-picker {
        margin-top: 8px;
        width: 100%;
    }
    
    .edit-date-input {
        width: 100%;
        padding: 10px 14px;
        border-radius: 10px;
    }
    
    .action-btn {
        padding: 12px;
        font-size: 0.9rem;
        border-radius: 10px;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .empty-state {
        padding: 40px 16px;
    }
    
    .empty-state i {
        font-size: 3rem;
    }
    
    .empty-state h3 {
        font-size: 1.2rem;
    }
    
    .empty-state p {
        font-size: 0.9rem;
    }

    /* Calendar mobile layout - Fixed backgrounds */
    .calendar-dropdown {
        position: fixed;
        top: 50%;
        left: 50%;
        right: auto;
        width: 90vw;
        max-width: 350px;
        background: #1e1e2e;
        transform: translate(-50%, -50%) scale(0.95);
        margin-top: 0;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.9);
    }

    .calendar-dropdown.show {
        transform: translate(-50%, -50%) scale(1);
    }

    .edit-calendar-dropdown {
        position: fixed;
        top: 50%;
        left: 50%;
        right: auto;
        width: 90vw;
        max-width: 320px;
        background: #1e1e2e;
        transform: translate(-50%, -50%) scale(0.95);
        margin-top: 0;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.9);
    }

    .edit-calendar-dropdown.show {
        transform: translate(-50%, -50%) scale(1);
    }

    .calendar-header {
        padding: 15px;
        background: #2a2a3e;
    }

    .calendar-grid {
        padding: 15px;
        background: #1e1e2e;
    }

    .day {
        font-size: 0.8rem;
        background: rgba(255, 255, 255, 0.05);
    }

    .day:not(.disabled):hover {
        background: rgba(102, 126, 234, 0.2);
    }

    .day.other-month {
        background: rgba(255, 255, 255, 0.02);
    }

    .day.today {
        background: rgba(255, 193, 7, 0.3);
    }

    .day.selected {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }

    .day.disabled {
        background: rgba(255, 255, 255, 0.01);
    }

   

 
}

/* Small mobile phones (320px - 480px) */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 2.4rem;
    }
    
    .header p {
        font-size: 0.9rem;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .stat-card {
        padding: 14px;
    }
    
    .stat-number {
        font-size: 1.6rem;
    }

    
    
    .tab-btn {
        padding: 8px 14px;
        font-size: 0.8rem;
    }
    
    .input-wrapper {
        padding: 14px;
    }
    
    .input-field {
        padding: 12px 16px;
        font-size: 0.95rem;
    }

    /* Keep text + calendar side by side */
  .input-row {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .input-row .input-field {
    flex: 1; /* take most of the row */
  }

  .input-row .custom-date-picker {
    flex-shrink: 0; /* calendar stays compact */
  }

  /* Add Task button stays full width below */
  .add-btn {
    margin-top: 10px;
    width: 100%;
    align-self: stretch;
  }
    
    .section {
        padding: 14px;
    }
    
    .todo-item, .reminder-item {
        padding: 14px;
    }
    
    .todo-text {
        font-size: 0.95rem;
    }
    
    .todo-deadline {
        font-size: 0.8rem;
    }
    
    .action-btn {
        padding: 10px;
        min-width: 40px;
        min-height: 40px;
    }
    
    #authControls button {
        font-size: 0.8rem;
        padding: 8px 14px;
    }
}

/* Performance optimizations */
.todo-item, .stat-card, .section {
    will-change: transform;
}

/* Reduce animations on low-performance devices */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .todo-item, .stat-card, .section {
        border-width: 2px;
    }
    
    .custom-checkbox .checkmark {
        border-width: 3px;
    }
    
    .date-trigger, #authControls button {
        border-width: 2px;
    }
}
