:root {
    --primary: #4361ee;
    --secondary: #3f37c9;
    --accent: #4895ef;
    --success: #4cc9f0;
    --danger: #f72585;
    --light: #f8f9fa;
    --dark: #212529;
    --difficulty-1: #a3e635;
    --difficulty-2: #16a34a;
    --difficulty-3: linear-gradient(to bottom, #d3c202, #ea7522);
    --difficulty-4: linear-gradient(to bottom, #8123d8, #ea7522);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-color: #f0f2f5;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

h1 {
    color: var(--primary);
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.2rem;
}

h2 {
    color: var(--secondary);
    font-size: 1.5rem;
    margin: 25px 0 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent);
}

.add-task {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.add-task input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.add-task input:focus {
    border-color: var(--accent);
    outline: none;
}

.add-task button {
    padding: 12px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.add-task button:hover {
    background: var(--secondary);
}

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

.filter-btn {
    padding: 8px 16px;
    background: #e9ecef;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn.active {
    background: var(--primary);
    color: white;
}

.tasks ul {
    list-style: none;
    padding: 0;
}

.tasks li {
    background: white;
    margin-bottom: 12px;
    padding: 18px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    transition: all 0.3s;
    animation: fadeIn 0.3s ease-out;
    gap: 20px;
}


.tasks li:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.tasks li.completed {
    background: #f8f9fa;
}

.tasks li.completed strong {
    color: #6c757d;
}

.tasks li .reopen-btn {
    background: #6c757d;
    color: white;
}

.tasks li .reopen-btn:hover {
    background: #5a6268;
}

.tasks li:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.tasks li .task-content {
    flex: 1;
    min-width: 0; /* Добавлено для переноса текста */
    word-break: break-word; /* Добавлено */
}

.tasks li strong {
    font-size: 1.3rem;
    color: var(--dark);
    display: block;
    margin-bottom: 5px;
    word-break: break-word; /* Добавлено */
}

.tasks li p {
    margin: 8px 0;
    color: #495057;
    font-size: 1.1rem;
    word-break: break-word; /* Добавлено */
}

.task-time {
    font-size: 1rem;
    color: #6c757d;
    display: block;
    margin-top: 8px;
}

.tasks li .task-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    justify-content: flex-end;
}

.tasks li button {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tasks li .complete-btn {
    background: var(--success);
    color: white;
}

.tasks li .complete-btn:hover {
    background: #3aa8d8;
}

.tasks li .delete-btn {
    background: var(--danger);
    color: white;
}

.tasks li .delete-btn:hover {
    background: #d51a6a;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }
    
    .add-task {
        flex-direction: column;
    }
}

/* Стили для редактирования */
.edit-mode {
    background-color: #fff9e6 !important;
  }
  
  .edit-input {
    width: 100%;
    padding: 12px;
    margin: 5px 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1.1rem;
    font-family: inherit;
    box-sizing: border-box;
}

.edit-input[type="text"] {
    height: 45px;
    min-height: 45px;
}

textarea.edit-input {
    min-height: 120px;
    resize: vertical;
    line-height: 1.5;
    padding: 12px;
}

  .edit-input[type="textarea"] {
    min-height: 100px; /* Увеличенная высота для описания */
    resize: vertical; /* Позволяет изменять размер */
  }
  
  .task-actions .edit-btn {
    background: #ffc107;
    color: #212529;
  }
  
  .task-actions .edit-btn:hover {
    background: #e0a800;
  }
  
  .save-cancel-btns {
    display: flex;
    gap: 8px;
    margin-top: 10px;
  }
  
  .save-btn, .cancel-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
  }
  
  .save-btn {
    background: #28a745;
    color: white;
  }
  
  .cancel-btn {
    background: #6c757d;
    color: white;
  }


/* Адаптация формы добавления */
@media (max-width: 600px) {
    .add-task {
        flex-direction: column;
    }
    
    .add-task input,
    .add-task select,
    .add-task button {
        width: 100%;
    }
}

/* Обновленные стили для метки сложности */
.task-difficulty {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 16px;
    background-color: #f8f9fa;
    color: #495057;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin: 8px 0; /* Добавлено */
    width: fit-content; /* Изменено */
    justify-content: flex-start; /* Изменено */
}

.task-difficulty::before {
    content: "";
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid white;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.difficulty-1 {
    border-left: 6px solid var(--difficulty-1);
    position: relative;
    overflow: hidden;
}

.difficulty-2 {
    border-left: 6px solid var(--difficulty-2);
    position: relative;
    overflow: hidden;
}

.difficulty-3 {
    border-left: 6px solid linear-gradient(to bottom, #d3c202, #ea7522);
    position: relative;
    overflow: hidden;
}

.difficulty-4 {
    border-left: 6px solid linear-gradient(to bottom, #9333ea, #f97316);
    position: relative;
    overflow: hidden;
}


/* Цвета для уровней сложности */
.difficulty-1 .task-difficulty::before {
    background-color: var(--difficulty-1);
    border-color: white;
}

.difficulty-2 .task-difficulty::before {
    background-color: var(--difficulty-2);
    border-color: white;
}

.difficulty-3 .task-difficulty::before {
    background: var(--difficulty-3);
    border-color: white;
}

.difficulty-3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: var(--difficulty-3);
    z-index: 1;
}

.difficulty-4 .task-difficulty::before {
    background: var(--difficulty-4);
    border-color: white;
}

/* Градиентная полоса для сложности 4 */    
.difficulty-4::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: var(--difficulty-4);
    z-index: 1;
}


/* Стили для выбора сложности с цветными опциями */
.difficulty-select {
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    background-color: white;
    min-width: 150px;
    transition: border-color 0.3s;
}

.difficulty-select:focus {
    border-color: var(--accent);
    outline: none;
}

.task-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    min-width: 120px;
    margin-left: auto;
}

.task-count {
    display: inline-block;
    min-width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    background-color: var(--primary);
    color: white;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-left: 6px;
    padding: 0 6px;
}

.filter-btn.active .task-count {
    background-color: white;
    color: var(--primary);
}

/* Стили для выбора сложности в режиме редактирования */
.edit-difficulty-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    background-color: white;
    width: 100%;
    transition: border-color 0.3s;
}

.edit-difficulty-select:focus {
    border-color: var(--accent);
    outline: none;
}

/* Цвета для выбора сложности в режиме редактирования */
.edit-difficulty-select.difficulty-1 {
    border-left: 3px solid var(--difficulty-1);
}

.edit-difficulty-select.difficulty-2 {
    border-left: 3px solid var(--difficulty-2);
}

.edit-difficulty-select.difficulty-3 {
    border-left: 3px solid;
    border-image: var(--difficulty-3);
    border-image-slice: 1;
}

.edit-difficulty-select.difficulty-4 {
    border-left: 3px solid;
    border-image: var(--difficulty-4);
    border-image-slice: 1;
}