* {
    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%);
    height: 100vh;
    overflow: hidden;
}

.screen {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hidden {
    display: none !important;
}

/* Login/Register Styles */
.login-container, .register-container {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    width: 400px;
    text-align: center;
}

.login-container h1, .register-container h1 {
    margin-bottom: 1.5rem;
    color: #333;
}

.login-container form, .register-container form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-container input, .register-container input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ccc;
    border-radius: 8px;
    font-size: 16px;
    color: #333;
    transition: all 0.3s ease;
}

.login-container input:focus, .register-container input:focus {
    border-color: #667eea;
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.4);
    outline: none;
}

.password-container {
    position: relative;
    width: 100%;
}

.password-container input[type="password"],
.password-container input[type="text"] {
    padding-right: 60px; /* Adjust based on button width */
}

.toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    padding: 5px;
}

.toggle-password i {
    font-size: 1.2em;
}

.toggle-password:hover {
    text-decoration: underline;
}
.login-btn{
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}
.toggle-password{
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.3s ease;
}
.register-container button {
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.login-container button:hover, .register-container button:hover {
    background: #5a6fd8;
}

.login-container a, .register-container a {
    color: #667eea;
    text-decoration: none;
}

/* Main App Styles */
#mainScreen {
    flex-direction: column;
    align-items: stretch;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    background: #f5f5f5;
    position: relative;
    overflow: hidden;
}

.app-header {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-header h1 {
    color: #333;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#logoutBtn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
}

.app-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 300px;
    background: white;
    padding: 2rem;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    overflow-y: auto;
}

.btn-primary {
    width: 100%;
    background: #27ae60;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    margin-bottom: 2rem;
}

.btn-primary:hover {
    background: #219a52;
}

.filters h3 {
    margin-bottom: 1rem;
    color: #333;
}

.filters select {
    width: 100%;
    padding: 8px;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.stats {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.task-controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    gap: 1rem;
}

.search-bar {
    position: relative;
    flex: 1;
}

.search-bar input {
    width: 100%;
    padding: 12px 40px 12px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.search-bar i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

#sortBy {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    min-width: 150px;
}

/* Task List Styles */
.task-list {
    display: grid;
    gap: 1rem;
}

.task-item {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.task-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.task-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
}

.task-actions {
    display: flex;
    gap: 0.5rem;
}

.task-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
    transition: background 0.2s;
}

.edit-btn:hover {
    background: #3498db;
    color: white;
}

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

.task-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.priority, .status {
    padding: 4px 8px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
}

.priority.High {
    background: #ffe6e6;
    color: #e74c3c;
}

.priority.Medium {
    background: #fff3cd;
    color: #856404;
}

.priority.Low {
    background: #d4edda;
    color: #155724;
}

.status.Pending {
    background: #f8f9fa;
    color: #6c757d;
}

.status.InProgress {
    background: #cce5ff;
    color: #004085;
}

.status.Completed {
    background: #d4edda;
    color: #155724;
}

.task-description {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.task-dates {
    font-size: 0.9rem;
    color: #999;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    width: 500px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

.form-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

#cancelTask {
    background: #6c757d;
    color: white;
}

#saveTask {
    background: #28a745;
    color: white;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 5px;
}

.pagination button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination button:hover:not(.active) {
    background: #f8f9fa;
}

/* Loading and Empty States */
.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #666;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Enhanced Statistics Styles */
.stats-enhanced {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    padding: 1.5rem;
    margin-top: 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.stats-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    pointer-events: none;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.stats-title {
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stats-popup-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.stats-popup-btn:hover,
.stats-popup-btn:focus,
.stats-popup-btn:active {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    outline: none;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.25rem;
    position: relative;
    z-index: 1;
    padding: 1rem 0.75rem;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease-in-out;
    margin: 0.5rem;
}

.stats-grid:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}


.stat-card {
    background: rgba(255,255,255,0.18);
    border-radius: 12px;
    padding: 1.5rem 2.25rem;
    text-align: center;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255,255,255,0.25);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, rgba(255,255,255,0.6), rgba(255,255,255,0.2));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px) scale(1.02);
    background: rgba(255,255,255,0.22);
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    border-color: rgba(255,255,255,0.35);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.95;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.completion-rate {
    margin-top: 1rem;
    position: relative;
    z-index: 1;
}

.completion-bar {
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.completion-progress {
    background: linear-gradient(90deg, #00ff88, #00cc6a);
    height: 100%;
    border-radius: 10px;
    transition: width 0.8s ease;
    box-shadow: 0 0 10px rgba(0,255,136,0.3);
}

/* Statistics Popup Styles */
.stats-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.stats-popup.active {
    opacity: 1;
    visibility: visible;
}

.stats-popup-content {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.8);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.stats-popup.active .stats-popup-content {
    transform: scale(1);
}

.stats-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
}

.stats-popup-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stats-popup-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.stats-popup-close:hover,
.stats-popup-close:focus,
.stats-popup-close:active {
    background: #f0f0f0;
    color: #333;
    outline: none;
    transform: scale(1.1);
}

.stats-popup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.75rem;
    margin-bottom: 2.5rem;
    padding: 0.5rem 0;
}

.popup-stat-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 50%, #e9ecef 100%);
    border-radius: 18px;
    padding: 2rem 1.75rem;
    text-align: center;
    border: 1px solid #dee2e6;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    position: relative;
    overflow: hidden;
}

.popup-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.popup-stat-card:hover {
    transform: translateY(-6px) scale(1.03);
    box-shadow: 0 16px 40px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.popup-stat-card:hover::before {
    opacity: 1;
}

.popup-stat-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    color: #667eea;
    text-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
    transition: transform 0.3s ease;
}

.popup-stat-card:hover .popup-stat-icon {
    transform: scale(1.1);
}

.popup-stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    line-height: 1.1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    letter-spacing: -0.02em;
}

.popup-stat-label {
    color: #6c757d;
    font-size: 0.95rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.charts-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    margin-top: 2.5rem;
    padding: 0.5rem 0;
}

.chart-container {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 18px;
    padding: 2rem;
    border: 1px solid #e9ecef;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.chart-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chart-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    border-color: #667eea;
}

.chart-container:hover::before {
    opacity: 1;
}

.chart-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1.5rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 0.875rem 1rem;
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    border-radius: 12px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.chart-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border-color: #667eea;
    background: linear-gradient(135deg, #ffffff 0%, #f0f4ff 100%);
}

.chart-item:last-child {
    margin-bottom: 0;
}

.chart-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.chart-icon {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.chart-value {
    font-weight: bold;
    color: #333;
}

.chart-bar {
    flex: 1;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    margin: 0 1rem;
    overflow: hidden;
}

.chart-progress {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s ease;
}

/* Chart Colors */
.status-pending { background-color: #6c757d; }
.status-inprogress { background-color: #007bff; }
.status-completed { background-color: #28a745; }

.priority-low { background-color: #28a745; }
.priority-medium { background-color: #ffc107; }
.priority-high { background-color: #dc3545; }

/* Responsive Design */
/* Extra large screens */
@media (max-width: 1400px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
        gap: 1.125rem;
    }
    
    .stat-card {
        padding: 1.375rem 1.75rem;
        min-height: 125px;
    }
}

@media (max-width: 1200px) {
    .app-content {
        gap: 1rem;
    }
    
    .sidebar {
        width: 280px;
        padding: 1.5rem;
    }
    
    .main-content {
        padding: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 1rem;
        margin: 0.25rem;
    }
    
    .stat-card {
        padding: 1.25rem 1.5rem;
        min-height: 120px;
    }
}

@media (max-width: 1024px) {
    .app-content {
        gap: 0.5rem;
    }
    
    .sidebar {
        width: 260px;
        padding: 1.25rem;
    }
    
    .main-content {
        padding: 1.25rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.875rem;
        margin: 0.25rem;
        padding: 0.75rem 0.5rem;
    }
    
    .stat-card {
        padding: 1rem 1.25rem;
        min-height: 110px;
    }
    
    .stats-popup-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }
    
    .charts-section {
        gap: 1.75rem;
        margin-top: 2rem;
    }
    
    .chart-container {
        padding: 1.75rem;
    }
}

@media (max-width: 768px) {
    #mainScreen {
        padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    }
    
    .app-content {
        flex-direction: column;
        gap: 0;
        min-height: calc(100vh - 80px);
        min-height: calc(100dvh - 80px);
    }
    
    .sidebar {
        width: 100%;
        order: 2;
        padding: 1.25rem;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        border-top: 1px solid #eee;
        max-height: 50vh;
        overflow-y: auto;
    }
    
    .main-content {
        order: 1;
        padding: 1.25rem;
        flex: 1;
        min-height: 50vh;
        overflow-y: auto;
    }
    
    .task-controls {
        flex-direction: column;
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }
    
    .form-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .stats-enhanced {
        margin-top: 1.5rem;
        padding: 1.25rem;
        border-radius: 12px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.875rem;
        padding: 0.5rem 0.25rem;
        margin: 0.25rem;
    }
    
    .stat-card {
        padding: 1rem 0.875rem;
        min-height: 100px;
        border-radius: 10px;
    }
    
    .stat-value {
        font-size: 1.6rem;
        margin-bottom: 0.375rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
        line-height: 1.1;
    }
    
    .charts-section {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        margin-top: 1.75rem;
    }
    
    .chart-container {
        padding: 1.25rem;
        border-radius: 15px;
    }
    
    .chart-item {
        padding: 0.75rem 0.875rem;
        margin-bottom: 0.75rem;
        border-radius: 10px;
    }
    
    .stats-popup-content {
        width: 95%;
        padding: 1.25rem;
        border-radius: 16px;
        max-height: 85vh;
        overflow-y: auto;
    }
    
    .stats-popup-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .popup-stat-card {
        padding: 1.25rem 1rem;
        border-radius: 15px;
        min-height: 140px;
    }
    
    .popup-stat-icon {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }
    
    .popup-stat-value {
        font-size: 1.875rem;
        margin-bottom: 0.375rem;
    }
    
    .popup-stat-label {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .app-header h1 {
        font-size: 1.25rem;
    }
    
    .sidebar {
        padding: 1rem;
        max-height: 45vh;
    }
    
    .main-content {
        padding: 1rem;
        min-height: 55vh;
    }
    
    .task-controls {
        gap: 0.5rem;
        margin-bottom: 1.25rem;
    }
    
    .search-bar input {
        padding: 10px 35px 10px 10px;
        font-size: 14px;
    }
    
    .stats-enhanced {
        margin-top: 1.25rem;
        padding: 1rem;
        border-radius: 10px;
    }
    
    .stats-header {
        margin-bottom: 1.25rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .stats-title {
        font-size: 1rem;
    }
    
    .stats-popup-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
        border-radius: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 0.375rem 0.125rem;
        margin: 0.125rem;
    }
    
    .stat-card {
        padding: 0.875rem 0.75rem;
        min-height: 90px;
        border-radius: 8px;
    }
    
    .stat-value {
        font-size: 1.375rem;
        margin-bottom: 0.25rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
        line-height: 1;
    }
    
    .completion-rate {
        margin-top: 0.75rem;
    }
    
    .completion-bar {
        height: 6px;
        margin-top: 0.375rem;
    }
    
    .stats-popup-content {
        width: 98%;
        padding: 1rem;
        margin: 0.5rem;
        border-radius: 12px;
        max-height: 90vh;
    }
    
    .stats-popup-header {
        margin-bottom: 1.5rem;
        padding-bottom: 0.75rem;
    }
    
    .stats-popup-title {
        font-size: 1.25rem;
    }
    
    .stats-popup-grid {
        grid-template-columns: 1fr;
        gap: 0.875rem;
        margin-bottom: 2rem;
    }
    
    .popup-stat-card {
        padding: 1rem 0.875rem;
        border-radius: 12px;
        min-height: 120px;
    }
    
    .popup-stat-icon {
        font-size: 1.875rem;
        margin-bottom: 0.375rem;
    }
    
    .popup-stat-value {
        font-size: 1.625rem;
        margin-bottom: 0.25rem;
    }
    
    .popup-stat-label {
        font-size: 0.8rem;
    }
    
    .charts-section {
        gap: 1rem;
        margin-top: 1.5rem;
    }
    
    .chart-container {
        padding: 1rem;
        border-radius: 12px;
    }
    
    .chart-title {
        font-size: 0.95rem;
        margin-bottom: 1rem;
    }
    
    .chart-item {
        padding: 0.625rem 0.75rem;
        margin-bottom: 0.625rem;
        border-radius: 8px;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .chart-label {
        font-size: 0.85rem;
    }
    
    .chart-value {
        font-size: 0.85rem;
    }
    
    .chart-bar {
        margin: 0.25rem 0.5rem;
        height: 5px;
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    .app-header {
        padding: 0.5rem 0.75rem;
    }
    
    .app-header h1 {
        font-size: 1.125rem;
    }
    
    .sidebar {
        padding: 0.75rem;
        max-height: 40vh;
    }
    
    .main-content {
        padding: 0.75rem;
        min-height: 60vh;
    }
    
    .stats-enhanced {
        padding: 0.875rem;
        margin-top: 1rem;
    }
    
    .stats-grid {
        gap: 0.625rem;
        padding: 0.25rem 0;
        margin: 0;
    }
    
    .stat-card {
        padding: 0.75rem 0.625rem;
        min-height: 80px;
        border-radius: 6px;
    }
    
    .stat-value {
        font-size: 1.25rem;
        margin-bottom: 0.125rem;
    }
    
    .stat-label {
        font-size: 0.65rem;
    }
    
    .stats-popup-content {
        width: 100%;
        padding: 0.875rem;
        margin: 0.25rem;
        border-radius: 10px;
    }
    
    .popup-stat-card {
        padding: 0.875rem 0.75rem;
        min-height: 100px;
        border-radius: 10px;
    }
    
    .popup-stat-icon {
        font-size: 1.625rem;
    }
    
    .popup-stat-value {
        font-size: 1.5rem;
    }
    
    .chart-container {
        padding: 0.875rem;
        border-radius: 10px;
    }
    
    .chart-item {
        padding: 0.5rem 0.625rem;
        margin-bottom: 0.5rem;
        border-radius: 6px;
    }
}