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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 0;
    margin: 0;
    color: #2d3748;
}

.todoapp {
    background: white;
    width: 100%;
    max-width: 550px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.3);
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 40px 30px 30px;
    flex-shrink: 0;
}

.header h1 {
    color: white;
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 24px;
    letter-spacing: 0.5px;
}

.header input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.header input::placeholder {
    color: #a0aec0;
    font-weight: 400;
}

.header input:focus {
    outline: none;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.main {
    flex: 1;
    overflow-y: auto;
    background: white;
}

.todo-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.item {
    position: relative;
    padding: 18px 30px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    transition: background 0.15s;
    background: white;
}

.item:hover {
    background: #fafafa;
}

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

.item.editing .view {
    display: none;
}

.item:not(.editing) .edit {
    display: none;
}

.view {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 12px;
}

.toggle {
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    appearance: none;
    transition: all 0.15s;
}

.toggle:checked {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    position: relative;
}

.toggle:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 12px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.toggle:hover {
    border-color: #9ca3af;
}

label {
    flex: 1;
    font-size: 15px;
    cursor: pointer;
    user-select: none;
    color: #1f2937;
    font-weight: 400;
}

.destroy {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    color: #d1d5db;
    font-size: 22px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.15s;
    flex-shrink: 0;
}

.destroy::before {
    content: '×';
}

.item:hover .destroy {
    opacity: 1;
}

.destroy:hover {
    color: #ef4444;
}

.edit {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #667eea;
    border-radius: 8px;
    font-family: inherit;
}

.edit:focus {
    outline: none;
    border-color: #764ba2;
}

.footer {
    padding: 16px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
    font-size: 13px;
    color: #6b7280;
    flex-wrap: wrap;
    gap: 12px;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.item-count strong {
    color: #2d3748;
    font-weight: 600;
}

.filters {
    list-style: none;
    display: flex;
    gap: 8px;
}

.filters a {
    padding: 5px 10px;
    border-radius: 4px;
    text-decoration: none;
    color: #6b7280;
    transition: all 0.15s;
    font-size: 13px;
}

.filters a:hover {
    color: #1f2937;
}

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

.clear-completed {
    padding: 5px 12px;
    border: none;
    border-radius: 4px;
    background: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 13px;
    font-weight: 400;
    transition: all 0.15s;
}

.clear-completed:hover {
    background: #fef2f2;
}

.hidden {
    display: none;
}

@media (max-width: 600px) {
    .todoapp {
        max-width: 100%;
    }

    .header {
        padding: 30px 20px 20px;
    }

    .header h1 {
        font-size: 24px;
    }

    .item {
        padding: 16px 20px;
    }

    .footer {
        padding: 12px 20px;
        font-size: 12px;
    }

    .filters {
        width: 100%;
        justify-content: center;
    }
}

.drag-handle {
    cursor: grab;
    color: #d1d5db;
    font-size: 18px;
    user-select: none;
    padding: 0 4px;
    transition: color 0.15s;
}

.drag-handle:hover {
    color: #9ca3af;
}

.drag-handle:active {
    cursor: grabbing;
}

.item.dragging {
    opacity: 0.5;
    background: #f3f4f6;
}

/* Drop zone styles */
.drop-zone {
    height: 8px;
    margin: 0;
    background: transparent;
    transition: all 0.2s ease;
    position: relative;
}

.drop-zone::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 30px;
    right: 30px;
    height: 2px;
    background: transparent;
    transform: translateY(-50%);
    transition: all 0.2s ease;
    border-radius: 2px;
}

.drop-zone-hover {
    height: 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

.drop-zone-hover::before {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 3px;
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.5);
}

/* Item drag-over state (when hovering over an item to drop after it) */
.item.drag-over {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    border-bottom-color: #667eea;
    border-bottom-width: 2px;
}

/* Offline Indicator Banner */
.offline-banner {
    display: none;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
    color: white;
    padding: 12px 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.offline-banner.visible {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    animation: pulse 2s ease-in-out infinite;
}

.offline-icon {
    font-size: 18px;
}

.offline-text {
    line-height: 1.4;
}

/* Subtle pulse animation for offline banner */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}