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

body {
    font-family: Arial, sans-serif;
    background-color: #f0f2f5;
    padding: 20px;
}

.container {
    max-width: 800px; /* Increased from 600px */
    margin: 0 auto;
    background: #f8f9fa;
    padding: 30px; /* Increased from 20px */
    border-radius: 12px; /* Increased from 8px */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 20px; /* Added to prevent top task from being cut off */
    margin-bottom: 20px;
    position: relative;
}

.container.showing-archived {
    background: #f0f2f5;
}

h1 {
    text-align: center;
    color: #1a73e8;
    margin-bottom: 20px;
}

.input-section {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

button {
    padding: 10px 20px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

button:hover {
    background: #1557b0;
}

.task {
    display: flex;
    align-items: center;
    padding: 12px 15px; /* Increased padding */
    background: #f8f9fa;
    margin-bottom: 16px;
    border-radius: 6px;
    transition: all 0.3s ease, transform 0.3s ease-out;
    transform-origin: center;
    will-change: transform, font-size, margin;
    position: relative;
    z-index: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.task:hover {
    z-index: 2; /* Ensure hovered task stays above others */
}

.task.completed {
    background: #e8f5e9;
    text-decoration: line-through;
    color: #666;
    opacity: 0.7;
}

.task.dragging {
    z-index: 3; /* Ensure dragged task stays on top */
    opacity: 0.9; /* Make it slightly more visible while dragging */
    background: #e3f2fd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.task.drag-over {
    border-top: 2px solid #1a73e8;
}

.task.removing {
    opacity: 0;
    transform: scale(0.8);
    margin-top: -50px;
}

.task-checkbox {
    margin-right: 4px; /* Further reduced from 6px */
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.task-actions {
    margin-left: auto;
}

.task-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin: 0 15px; /* Add margin on both sides */
    color: #333;
}

.task-text {
    flex: 1;
    font-weight: 500; /* Make task name slightly bolder */
    transition: font-size 0.3s ease;
    font-size: 15px; /* Base size for task text */
}

.task-description {
    font-size: 13px; /* Smaller than task text */
    color: #666;
    margin-top: 2px;
    display: block;
    max-width: 100%;
    font-weight: normal;
}

.drag-handle {
    cursor: move;
    padding: 0 2px; /* Further reduced from 4px */
    color: #999;
    font-size: 20px;
    user-select: none;
    display: flex;
    align-items: center;
    height: 100%;
    margin-right: 0; /* Removed margin completely */
}

.task-checkbox,
.task-actions button {
    pointer-events: all;
}

.task.dragging .task-checkbox,
.task.dragging .task-actions button {
    pointer-events: none;
}

#taskList {
    list-style: none;
    padding: 20px;
    margin-top: 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    /* Add padding for scaled items */
    margin-left: 20px;
    margin-right: 20px;
}

li {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e6e6e6;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    transform-origin: top center;
}

/* Replace the previous nth-child rules with these new ones */
#taskList li:nth-child(1) {
    transform: scale(1);
    margin-bottom: 12px;
    z-index: 5;
}

#taskList li:nth-child(2) {
    transform: scale(0.98);
    margin-bottom: 10px;
    z-index: 4;
}

#taskList li:nth-child(3) {
    transform: scale(0.96);
    margin-bottom: 8px;
    z-index: 3;
}

#taskList li:nth-child(4) {
    transform: scale(0.94);
    margin-bottom: 6px;
    z-index: 2;
}

#taskList li:nth-child(n+5) {
    transform: scale(0.92);
    margin-bottom: 4px;
    z-index: 1;
}

li:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

li:last-child {
    margin-bottom: 0;
}

.archived {
    background: #f8f9fa;
    cursor: default;
    border-left: 4px solid #1a73e8;
    border-color: #ddd;
}

.archived {
    background: white;
    border-left: 4px solid #1a73e8;
    margin-bottom: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.archived:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.completed {
    background: #e8f5e9;
    border-color: #c8e6c9;
}

.task-menu-btn {
    background: none;
    border: none;
    color: #666;
    padding: 4px 8px;
    cursor: pointer;
    margin-left: 8px;
    font-size: 18px;
}

.task-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: none;
    z-index: 1000;
}

.task-menu.show {
    display: block;
}

.task-menu button {
    display: block;
    width: 100%;
    padding: 8px 16px;
    text-align: left;
    border: none;
    background: none;
    color: #333;
    cursor: pointer;
}

.task-menu button:hover {
    background: #f5f5f5;
}

.task.editing .task-content {
    display: none;
}

.edit-form {
    display: none;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    margin: 0 15px;
}

.task.editing .edit-form {
    display: flex;
}

.edit-form input {
    padding: 6px 10px;
    font-size: 14px;
}

.edit-form .save-btn {
    align-self: flex-end;
    margin-top: 4px;
    padding: 6px 12px;
    background: #4CAF50;
    font-size: 13px;
}

.edit-form .save-btn:hover {
    background: #45a049;
}

.edit-form .edit-task-list {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 8px;
    background-color: white;
}

.edit-form .edit-task-list:focus {
    border-color: #1a73e8;
    outline: none;
}

.menu-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
}

.task-content {
    flex: 1;
    margin-right: 16px;
    color: #333;
}

.section-toggle {
    display: block;
    margin: 0 auto 20px;
    background: #1a73e8;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.section-toggle:hover {
    background: #1557b0;
}

.section-toggle.in-archive-view {
    background: #666;
    margin-bottom: 30px;
}

.section-toggle.in-archive-view:hover {
    background: #555;
}

.section-toggle.highlight {
    animation: pulse 1s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); background: #28a745; }
    100% { transform: scale(1); }
}

.archived {
    background: #f8f9fa;
    cursor: default;
    border-left: 4px solid #1a73e8;
    border-color: #ddd;
}

.archive-date {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 4px;
    font-style: italic;
}

.archived .task-content span {
    color: #666;
}

.task-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.restore-btn {
    background: #4CAF50;
    margin-right: 8px;
}

.restore-btn:hover {
    background: #45a049;
}

.delete-btn {
    background: #dc3545;
}

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

.progress-text {
    font-size: 12px;
    color: #666;
    margin-left: 8px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
    user-select: none;
}

.progress-text:hover {
    background-color: #f0f0f0;
    color: #1a73e8;
}

.progress-editor {
    margin-top: 8px;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.progress-range {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    background: #e0e0e0;
    border-radius: 2px;
    outline: none;
}

.progress-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #1a73e8;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s;
}

.progress-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #1a73e8;
    border-radius: 4px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    background: transparent;
    transition: all 0.2s ease;
}

.completed .checkbox {
    background: #1a73e8;
    border-color: #1a73e8;
}

.trash-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.trash-btn:hover {
    opacity: 1;
    background: none;
}

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

.action-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.6;
    transition: all 0.2s;
    margin-left: 4px;
}

.action-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.delete-btn {
    color: #dc3545;
}

.archive-btn {
    color: #1a73e8;
}

.restore-btn {
    color: #28a745;
}

.no-tasks {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.no-tasks p {
    margin-bottom: 15px;
    font-size: 16px;
}

.back-btn {
    background: #666;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    font-size: 14px;
}

.back-btn:hover {
    background: #555;
}

.task.editing {
    background: #f0f7ff;
    border: 1px solid #1a73e8;
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.2);
}

.edit-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding: 8px;
}

.edit-form input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.edit-form .edit-title {
    font-weight: 500;
}

.edit-form .edit-description {
    color: #666;
}

.edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.edit-actions button {
    padding: 6px 12px;
    font-size: 14px;
}

.edit-actions .save-btn {
    background: #1a73e8;
    color: white;
}

.edit-actions .save-btn:hover {
    background: #1557b0;
}

.edit-actions .cancel-btn {
    background: #f1f3f4;
    color: #5f6368;
}

.edit-actions .cancel-btn:hover {
    background: #e8eaed;
}

.task-list-controls {
    position: absolute;
    top: 20px;
    right: 20px;
}

.task-list-selector {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 200px;
    cursor: pointer;
}

.task-list-selector option.new-list-option {
    font-style: italic;
    border-top: 1px solid #ddd;
    padding-top: 4px;
    color: #1a73e8;
}

.task-list-dialog {
    border: none;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.task-list-dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.5);
}

.task-list-dialog h3 {
    margin-bottom: 16px;
    color: #1a73e8;
}

.task-list-dialog input {
    width: 100%;
    margin-bottom: 16px;
}

.dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* AI Generator Button */
.ai-generator-btn {
    background-color: #ff8c00; /* Orange color */
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    margin-bottom: 15px;
    transition: background-color 0.3s;
    display: block;
}

.ai-generator-btn:hover {
    background-color: #e67e00; /* Slightly darker orange for hover state */
}

/* AI Dialog Styles */
.ai-dialog textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: inherit;
    margin-bottom: 15px;
    resize: vertical;
}

.generating-indicator {
    text-align: center;
    margin-top: 15px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-left-color: #ff8c00;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Dialog Styles */
dialog.dialog {
    border: none;
    border-radius: 10px;
    padding: 24px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    background-color: #fff;
}

dialog.dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

dialog.dialog h3 {
    margin-top: 0;
    margin-bottom: 16px;
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
}

dialog.dialog input,
dialog.dialog textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: inherit;
    margin-bottom: 16px;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

dialog.dialog input:focus,
dialog.dialog textarea:focus {
    outline: none;
    border-color: #ff8c00;
    box-shadow: 0 0 0 2px rgba(255, 140, 0, 0.1);
}

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

dialog.dialog button {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s;
}

dialog.dialog button[type="button"] {
    background-color: #f1f1f1;
    color: #333;
}

dialog.dialog button[type="button"]:hover {
    background-color: #e0e0e0;
}

dialog.dialog button[type="submit"] {
    background-color: #ff8c00;
    color: white;
}

dialog.dialog button[type="submit"]:hover {
    background-color: #e67e00;
}

/* AI Dialog Specific Styles */
.ai-dialog p {
    margin-bottom: 12px;
    color: #555;
}

.generating-indicator {
    text-align: center;
    margin: 20px 0;
}

.generating-indicator p {
    margin-bottom: 16px;
    font-weight: 500;
    color: #333;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 140, 0, 0.2);
    border-radius: 50%;
    border-left-color: #ff8c00;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }