/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

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

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #4c51bf;
    margin-bottom: 10px;
}

.header h1 i {
    margin-right: 15px;
    color: #667eea;
}

.stats {
    font-size: 1.1rem;
    color: #666;
}

.overdue-stat {
    color: #f56565;
    font-weight: 600;
    font-weight: 500;
}

.stats span {
    color: #4c51bf;
    font-weight: 600;
}

.server-info {
    margin-top: 15px;
}

.check-server-btn {
    padding: 8px 16px;
    background: rgba(102, 126, 234, 0.1);
    color: #4c51bf;
    border: 1px solid #4c51bf;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.check-server-btn:hover {
    background: #4c51bf;
    color: white;
}

/* Main Container */
.main-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    flex: 1;
}

/* Input Section */
.input-section {
    margin-bottom: 30px;
}

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

#todo-input {
    flex: 1;
    min-width: 250px;
    padding: 15px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    background: #f8fafc;
    transition: all 0.3s ease;
}

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

#priority-select, #sort-select, #edit-priority-select {
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

#priority-select:focus, #sort-select:focus, #edit-priority-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

#add-btn {
    padding: 15px 25px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

#add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

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

/* Deadline Input Group */
.deadline-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 200px;
}

.deadline-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 8px;
}

.deadline-group label i {
    color: #667eea;
}

#deadline-input, #edit-deadline-input {
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    background: white;
    transition: all 0.3s ease;
    color: #4a5568;
}

#deadline-input:focus, #edit-deadline-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* Filter Section */
.filter-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
    flex-wrap: wrap;
}

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

.filter-btn {
    padding: 10px 20px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn.active {
    background: #4c51bf;
    color: white;
    border-color: #4c51bf;
}

.filter-btn:hover:not(.active) {
    border-color: #4c51bf;
    color: #4c51bf;
}

.filter-btn[data-filter="overdue"].active {
    background: #f56565;
    color: white;
    border-color: #f56565;
}

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

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

#clear-completed {
    background: #fed7d7;
    color: #c53030;
}

#clear-completed:hover {
    background: #feb2b2;
}

#mark-all-complete {
    background: #c6f6d5;
    color: #22543d;
}

#mark-all-complete:hover {
    background: #9ae6b4;
}

/* Todo List */
.todo-container {
    min-height: 300px;
}

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

.todo-item {
    display: flex;
    align-items: center;
    padding: 20px;
    margin-bottom: 15px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border-left: 4px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.todo-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.todo-item.priority-high {
    border-left-color: #e53e3e;
}

.todo-item.priority-medium {
    border-left-color: #d69e2e;
}

.todo-item.priority-low {
    border-left-color: #38a169;
}

.todo-item.completed {
    opacity: 0.6;
    background: #f7fafc;
}

.todo-item.completed .todo-text {
    text-decoration: line-through;
    color: #a0aec0;
}

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

.todo-checkbox.completed {
    background: #4c51bf;
    border-color: #4c51bf;
    color: white;
}

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

.todo-text {
    font-size: 1.1rem;
    font-weight: 500;
    word-break: break-word;
}

.todo-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.85rem;
    color: #718096;
}

.priority-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.priority-high .priority-badge {
    background: #fed7d7;
    color: #c53030;
}

.priority-medium .priority-badge {
    background: #fefcbf;
    color: #d69e2e;
}

.priority-low .priority-badge {
    background: #c6f6d5;
    color: #22543d;
}

/* Deadline Styling */
.deadline-info {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 8px;
    background: #e6fffa;
    color: #065f46;
}

.deadline-info i {
    font-size: 0.75rem;
}

.deadline-info.overdue {
    background: #fed7d7;
    color: #c53030;
    font-weight: 600;
}

/* Overdue Todo Item */
.todo-item.overdue {
    border-left: 4px solid #f56565;
    background: linear-gradient(90deg, #fed7d7 0%, rgba(255, 255, 255, 0.95) 10%);
}

.todo-item.overdue .todo-text {
    color: #c53030;
}

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

.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-edit {
    background: #bee3f8;
    color: #2c5282;
}

.btn-edit:hover {
    background: #90cdf4;
}

.btn-delete {
    background: #fed7d7;
    color: #c53030;
}

.btn-delete:hover {
    background: #feb2b2;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #a0aec0;
}

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

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

/* Footer Progress */
.footer {
    margin-top: 30px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.progress-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.progress-text {
    text-align: center;
    font-weight: 600;
    color: #4c51bf;
}

.progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

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

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 10% auto;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease;
}

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

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

.modal-header h3 {
    font-weight: 600;
    color: #4c51bf;
}

.close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #a0aec0;
}

.close:hover {
    color: #4a5568;
}

.modal-body {
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#edit-input {
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    width: 100%;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.btn-primary {
    padding: 12px 24px;
    background: #4c51bf;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: #434190;
}

.btn-secondary {
    padding: 12px 24px;
    background: #e2e8f0;
    color: #4a5568;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-section {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .filter-buttons {
        justify-content: center;
    }
    
    .bulk-actions {
        justify-content: center;
    }
    
    .todo-item {
        padding: 15px;
    }
    
    .todo-actions {
        margin-top: 10px;
    }
    
    .deadline-group {
        min-width: auto;
        width: 100%;
    }
    
    .todo-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 20px;
    }
    
    .main-container {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .stats {
        font-size: 1rem;
    }
    
    .modal-content {
        margin: 20% auto;
        width: 95%;
    }
}