* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    padding: 20px;
    width: 100%;
    max-width: 540px;
}

.todo-app {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

h1 {
    color: #1a1a1a;
    margin-bottom: 20px;
    font-size: 28px;
    font-weight: 600;
}

.input-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f8f8f8;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
}

.task-input-row {
    display: flex;
    gap: 10px;
}

#taskInput {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 12px;
    background: white;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

#taskInput:focus {
    box-shadow: 0 2px 10px rgba(118, 75, 162, 0.2);
}

.collaborator-input {
    display: flex;
    gap: 10px;
    align-items: center;
}

#collaboratorInput {
    flex: 1;
    padding: 12px 15px;
    border: none;
    border-radius: 12px;
    background: white;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

#collaboratorInput:focus {
    box-shadow: 0 2px 10px rgba(118, 75, 162, 0.2);
}

#addCollaborator {
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    background: #764ba2;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#addCollaborator:hover {
    background: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

#addTask {
    padding: 12px 25px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(45deg, #764ba2, #667eea);
    color: white;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    align-self: flex-end;
}

#addTask:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(118, 75, 162, 0.3);
}

.filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.filter {
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 15px;
    color: #666;
    transition: all 0.3s ease;
}

.filter.active {
    background: #764ba2;
    color: white;
}

#taskList {
    list-style: none;
    margin-bottom: 20px;
}

.task-item {
    padding: 15px;
    background: #f8f8f8;
    margin-bottom: 10px;
    border-radius: 12px;
    animation: slideIn 0.3s ease;
    border-left: 4px solid transparent;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.task-item.completed {
    opacity: 0.7;
    background: #f0f0f0;
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: #666;
}

.checkbox {
    width: 20px;
    height: 20px;
    margin-right: 15px;
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid #764ba2;
    position: relative;
}

.checkbox.checked::after {
    content: '✓';
    position: absolute;
    color: white;
    background: #764ba2;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.task-text {
    flex: 1;
    font-size: 16px;
}

.delete-btn {
    background: none;
    border: none;
    color: #ff5757;
    cursor: pointer;
    font-size: 18px;
    opacity: 0;
    transition: all 0.3s ease;
}

.task-item:hover .delete-btn {
    opacity: 1;
}

.task-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #666;
    font-size: 14px;
}

#clearCompleted {
    background: none;
    border: none;
    color: #764ba2;
    cursor: pointer;
    font-size: 14px;
}

#clearCompleted:hover {
    text-decoration: underline;
}

/* Priority Styles */
.priority-selector {
    display: flex;
    gap: 10px;
    padding: 5px 0;
}

.priority-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    opacity: 0.7;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.priority-btn.selected {
    opacity: 1;
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.priority-btn[data-priority="low"] {
    background: #4CAF50;
    color: white;
}

.priority-btn[data-priority="medium"] {
    background: #FFC107;
    color: black;
}

.priority-btn[data-priority="high"] {
    background: #FF5252;
    color: white;
}

/* Collaborator Styles */
.collaborators {
    display: flex;
    gap: 5px;
    margin-left: 10px;
}

.collaborator-circle {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
    font-size: 14px;
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    70% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.collaborator-circle:hover {
    transform: scale(1.1);
    transition: transform 0.3s ease;
}

/* Task item with priority indicator */
.task-item[data-priority="low"] {
    border-left-color: #4CAF50;
}

.task-item[data-priority="medium"] {
    border-left-color: #FFC107;
}

.task-item[data-priority="high"] {
    border-left-color: #FF5252;
}

/* Collaborators Preview Section */
.collaborators-preview {
    display: flex;
    gap: 8px;
    padding: 10px 0;
    min-height: 45px;
    align-items: center;
}

.collaborators-preview:empty::before {
    content: 'No collaborators added';
    color: #999;
    font-size: 14px;
    font-style: italic;
}

/* Task Item Layout */
.task-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-main {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.task-collaborators {
    display: flex;
    gap: 5px;
    padding-left: 45px; /* Align with task text */
}

.task-collaborators .collaborator-circle {
    width: 25px; /* Smaller size for task view */
    height: 25px;
    font-size: 12px;
}

/* Collaborator circle hover effect */
.collaborator-circle {
    position: relative;
}

.collaborator-circle:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
    margin-bottom: 5px;
    z-index: 1;
}

/* Add styles for description field */
.task-description {
    width: 100%;
}

#taskDescription {
    width: 100%;
    padding: 12px 15px;
    border: none;
    border-radius: 12px;
    background: white;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

#taskDescription:focus {
    box-shadow: 0 2px 10px rgba(118, 75, 162, 0.2);
}

/* Update task card styles */
.task-item {
    padding: 15px;
    background: #f8f8f8;
    margin-bottom: 10px;
    border-radius: 12px;
    animation: slideIn 0.3s ease;
}

.task-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-description-text {
    padding-left: 45px;
    color: #666;
    font-size: 14px;
    line-height: 1.4;
}

.task-collaborators-count {
    display: flex;
    align-items: center;
    gap: 5px;
    padding-left: 45px;
    color: #666;
    font-size: 13px;
}

.collaborator-count-circle {
    background: #764ba2;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
}

/* Mobile-first responsive design */
@media screen and (max-width: 768px) {
    .task-item {
        padding: 10px;
        font-size: 16px;
    }

    .task-content {
        flex-direction: column;
    }

    .task-main {
        width: 100%;
        flex-wrap: wrap;
    }

    .checkbox {
        min-width: 24px;
        min-height: 24px;
        margin-right: 10px;
    }

    .delete-btn {
        padding: 8px 12px;
        font-size: 20px;
    }

    .task-description-text {
        margin-top: 8px;
        font-size: 14px;
    }

    .collaborator-count-circle {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }

    /* Improve touch targets */
    button, 
    .checkbox,
    .filter,
    .priority-btn {
        min-height: 44px;
        min-width: 44px;
        padding: 12px;
    }

    /* Prevent text from being too small */
    input, 
    textarea {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
        padding: 12px;
    }
}

/* Prevent touch highlighting */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Allow text selection in inputs and textareas */
input, 
textarea {
    -webkit-user-select: text;
    user-select: text;
}