/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #fdf6e3;
    color: #333;
    line-height: 1.5;
    height: 100vh;
    overflow-x: hidden;
}

/* Basic container */
.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: #fff;
}

/* Header styles */
header {
    background-color: #e67e22;
    color: white;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    text-align: center;
    flex: 1;
}

.primary-btn {
    background-color: #fff;
    color: #e67e22;
    border: none;
    border-radius: 30px;
    padding: 8px 16px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* View toggle styles */
.view-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
}

input:checked+.toggle-slider {
    background-color: rgba(255, 255, 255, 0.8);
}

input:checked+.toggle-slider:before {
    transform: translateX(26px);
}

.toggle-label {
    color: white;
    font-size: 0.9rem;
    white-space: nowrap;
}

/* Connection error */
.connection-error {
    background-color: #FEF2F2;
    border-left: 4px solid #E74C3C;
    padding: 12px;
    margin: 12px;
    border-radius: 8px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.error-icon {
    color: #E74C3C;
}

.error-message h3 {
    margin: 0 0 4px 0;
    color: #E74C3C;
}

.retry-btn {
    background-color: #f5f5f5;
    color: #333;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Task Input Form */
.add-task-form {
    display: flex;
    padding: 12px;
    border-bottom: 1px solid #eee;
    background-color: #fff;
}

.task-input {
    flex: 1;
    padding: 10px;
    font-size: 1.1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-right: 10px;
}

.task-input.textarea {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}

.task-input:focus {
    outline: none;
    border-color: #e67e22;
}

.add-task-btn {
    background-color: #e67e22;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 1rem;
    cursor: pointer;
}

/* Tasks container */
.tasks-container {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 70px;
    background-color: #fdf6e3;
}

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

/* Task item styles */
.task-item {
    background-color: white;
    border-radius: 6px;
    margin: 8px;
    padding: 12px;
    display: flex;
    align-items: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
    min-height: 60px;
    border-left: 3px solid rgba(230, 126, 34, 0.3);
}

/* Temporary task styling */
.task-item.temp {
    background-color: rgba(255, 255, 255, 0.8);
    border-left: 3px dashed rgba(230, 126, 34, 0.5);
    position: relative;
}

.task-item.temp::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(230, 126, 34, 0.1), transparent);
    background-size: 200% 100%;
    animation: loading-pulse 1.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes loading-pulse {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

.task-text {
    flex: 1;
    font-size: 1.1rem;
    word-break: break-word;
    padding: 4px 0;
    cursor: pointer;
}

.task-actions {
    display: flex;
    gap: 12px;
    margin-left: 8px;
}

.task-button {
    background: none;
    border: none;
    color: #777;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.task-button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Completed task style */
.task-item.completed {
    opacity: 0.7;
    background-color: #f9f9f9;
    border-left-color: rgba(230, 126, 34, 0.1);
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: #888;
}

.task-item.completed .complete-btn {
    color: #e67e22;
}

/* Loading, error, and empty states */
.loading-item,
.error-item,
.empty-item {
    text-align: center;
    padding: 20px;
    font-size: 1rem;
    color: #777;
    font-style: italic;
    background: rgba(255, 255, 255, 0.7);
    margin: 8px;
    border-radius: 6px;
}

.error-item {
    color: #E74C3C;
}

/* Actions container */
.tasks-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.1);
    z-index: 100;
    display: flex;
    justify-content: center;
}

.clear-completed-btn {
    padding: 10px 20px;
    background-color: rgba(230, 126, 34, 0.1);
    color: #e67e22;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

/* Modal styles */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 900;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 85%;
    width: 100%;
    max-height: 80%;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    background-color: #e67e22;
    color: white;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.close-modal {
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 16px;
    overflow-y: auto;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 1rem;
}

.form-group input {
    width: 100%;
    padding: 10px;
    font-size: 1.1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.form-group input:focus {
    border-color: #e67e22;
    outline: none;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
}

.cancel-btn {
    background-color: #f5f5f5;
    color: #777;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.submit-btn {
    background-color: #e67e22;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.delete-btn {
    background-color: #E74C3C;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.task-to-complete,
.task-to-delete {
    background-color: rgba(253, 246, 227, 0.5);
    padding: 12px;
    margin: 12px 0;
    border-radius: 6px;
    font-size: 1.1rem;
    word-break: break-word;
    border-left: 3px solid rgba(230, 126, 34, 0.3);
}

/* Media queries - simplified for better performance */
@media (max-width: 480px) {
    .toggle-label {
        display: none;
    }

    header h1 {
        font-size: 1.8rem;
    }
}