/* 🌐 Общие стили для страницы */
body {
  background-color: #f5f5f5;
  margin: 0;
  font-family: sans-serif;
}

.page-wrapper {
  max-width: 1300px;
  margin: 0 auto;
  background-color: white;
  min-height: 100vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* 🧭 Шапка */
header {
  border-bottom: 1px solid #ccc;
  background-color: white;
}

.header-inner {
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left a {
  font-weight: bold;
  text-decoration: none;
  color: inherit;
}

.header-center a {
  margin-left: 20px;
  text-decoration: none;
  color: inherit;
}

.header-right {
  position: relative;
}

/* Показываем основное меню и скрываем гамбургер на десктопе */
.header-center {
  display: flex;
  gap: 20px;
}

#menu-toggle,
.mobile-nav-menu {
  display: none;
}

/* Обёртка для гамбургера и меню */
.header-toggle-wrapper {
  position: relative;
}

/* На мобилках — наоборот */
@media (max-width: 768px) {
  .header-center {
    display: none;
  }

  .header-toggle-wrapper {
    display: block;
    position: relative;
  }

  #menu-toggle {
    display: block;
    font-size: 22px;
    cursor: pointer;
    padding-left: 12px;
  }

  .mobile-nav-menu {
    display: none;
    position: absolute;
    top: 28px;
    right: 0;
    background: white;
    border: 1px solid #ccc;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    z-index: 999;
    padding: 10px 14px;
    min-width: 140px;
  }

  .mobile-nav-menu.show {
    display: block;
  }

  .mobile-nav-menu a {
    display: block;
    margin: 6px 0;
    color: #333;
    text-decoration: none;
  }

  .mobile-nav-menu a:hover {
    text-decoration: underline;
  }
}


/* 🔗 Ссылки для навигации в шапке */
.nav-link {
  text-decoration: none;
  color: inherit;
  font-weight: normal;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.forgot-link {
  font-size: 0.9em;
  text-decoration: none;
  color: #0099e5;
}

.forgot-link:hover {
  text-decoration: underline;
}

/* 👤 Меню пользователя */
.user-icon {
  cursor: pointer;
  font-size: 18px;
  user-select: none;
}

.user-menu {
  position: absolute;
  top: 28px;
  right: 0;
  background: white;
  border: 1px solid #ccc;
  padding: 10px;
  min-width: 160px;
  display: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

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

.user-menu strong {
  display: block;
  margin-bottom: 8px;
}

.user-menu a,
.user-menu form button {
  display: block;
  background: none;
  border: none;
  padding: 5px 0;
  text-align: left;
  cursor: pointer;
  width: 100%;
  font: inherit;
  color: #333;
  text-decoration: none;
}

/* 📄 Основной контент */
main {
  padding: 20px;
  position: relative;
  z-index: 2;
  flex-grow: 1;
}

/* 🔻 Подвал */
footer.footer {
  background-color: white;
  border-top: 1px solid #ccc;
  height: 120px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  font-size: 14px;
  padding: 20px;
  box-sizing: border-box;
}

.footer-content {
  display: flex;
  gap: 24px;
  align-items: center;
  color: #555;
}

.footer-content a {
  color: #007bff;
  text-decoration: none;
}

.footer-content a:hover {
  text-decoration: underline;
}

/* 🔐 Объединённые стили для форм логина и регистрации */
.auth-form, .register-form {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 300px;
}

.form-group, .register-field {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}

.form-group label, .register-field label {
  margin-top: 12px;
  margin-bottom: 2px;
  display: block;
  font-weight: normal;
}

.form-group input, .register-field input {
  padding: 6px;
  font: inherit;
  box-sizing: border-box;
  width: 100%;
  margin: 0;
}

.checkbox-group, .register-checkbox {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 16px;
}

.checkbox-group label, .register-checkbox label {
  display: inline-block;
  vertical-align: middle;
  line-height: 1.2;
  margin: 0;
  padding: 0;
}

.checkbox-group input[type="checkbox"], .register-checkbox input[type="checkbox"] {
  margin: 0;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.form-error, .register-error {
  color: red;
  margin-top: 12px;
}

.auth-actions, .register-actions {
  display: inline-flex;
  align-items: center;
  gap: 40px;
  margin-top: 16px;
  flex-wrap: nowrap;
}

.auth-actions button, .register-actions button {
  padding: 8px 16px;
  background-color: #0099e5;
  color: white;
  border: none;
  border-radius: 4px;
  font: inherit;
  cursor: pointer;
}

.auth-actions button:hover, .register-actions button:hover {
  background-color: #007ecc;
}

.auth-actions .auth-link, .register-actions .register-link {
  color: #0099e5;
  text-decoration: none;
  font-size: 0.95em;
  line-height: 1;
  display: inline-block;
  vertical-align: middle;
  white-space: nowrap;
}

.auth-actions .auth-link:hover, .register-actions .register-link:hover {
  text-decoration: underline;
}

/* === 📋 Таблица задач === */
.task-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 14px;
}

.task-table th {
  text-align: left;
  font-weight: normal;
  padding: 8px 12px 2px 12px;
  border-bottom: 1px solid #ccc;
}

.task-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}

/* 🎨 Цвета строк */
.task-table tr.overdue {
  background-color: #ffe5e5;
}

.task-table tr.archived {
  background-color: #f2f2f2;
  color: #999;
}

.task-table tr.archived a {
  color: #999;
}

/* 📱 Адаптивность таблицы */
@media (max-width: 768px) {
  .task-table thead {
    display: none;
  }

  .task-table, .task-table tbody, .task-table tr, .task-table td {
    display: block;
    width: 100%;
  }

  .task-table tr {
    margin-bottom: 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 12px;
    background: #fff;
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    box-sizing: border-box;
  }

  .task-table td {
    padding: 6px 0;
    border: none;
  }

  .task-table td::before {
    content: attr(data-label);
    font-size: 12px;
    color: #777;
    text-transform: uppercase;
    display: block;
    margin-bottom: 2px;
  }

  .task-menu-cell {
    text-align: left;
    margin-top: 12px;
  }
}

/* 🔗 Ссылки */
a {
  color: #0066cc;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.add-task {
  color: #0088cc;
  margin-right: 16px;
}

.archive-link {
  float: right;
  color: #333;
  font-size: 14px;
}

/* ⋮ Меню задач */
.task-menu {
  position: relative;
}

.menu-dots {
  cursor: pointer;
  font-size: 18px;
  padding: 0 4px;
}

.menu-popup {
  display: none;
  position: absolute;
  right: 0;
  top: 24px;
  background: #fff;
  border: 1px solid #ccc;
  padding: 8px;
  z-index: 10;
  white-space: nowrap;
}

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

.menu-popup form,
.menu-popup a {
  display: block;
  margin-bottom: 6px;
}

.menu-popup button {
  background: none;
  border: none;
  padding: 4px 0;
  color: green;
  cursor: pointer;
  font-size: 14px;
}

.menu-popup a {
  color: #0066cc;
}

.menu-popup .danger {
  color: red;
}

/* 🧾 Страница отдельной задачи */
.task-detail {
  max-width: 700px;
  margin-top: 20px;
}

.back-link {
  display: inline-block;
  margin-bottom: 24px;
  font-size: 14px;
  color: #0077cc;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

/* 🧱 UI-кит: поля и подписи */
.field {
  margin-bottom: 24px;
}

.field-label {
  display: block;
  font-size: 12px;
  color: #777;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.field-value {
  font-size: 16px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  max-width: 500px;
  padding: 6px 10px;
  font-size: 15px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: inherit;
  box-sizing: border-box;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #007bff;
  outline: none;
}

.select-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.remove-select {
  border: none;
  background: none;
  color: #c00;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.nf-link {
  margin-top: 4px;
}

.date-picker-wrapper {
  position: relative;
  display: inline-block;
  width: 200px; /* Примерно половина от обычной ширины */
}

.date-picker-wrapper input.datetimepicker {
  width: 100%;
  padding-right: 28px; /* Чтобы текст не заходил под иконку */
  box-sizing: border-box;
}

.calendar-icon {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 16px;
  color: #666;
}

/* 🖋 Кнопки */
.actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.actions-left {
  justify-content: flex-start;
}

.btn {
  padding: 6px 12px;
  font-size: 14px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  box-sizing: border-box;
}

.btn-success {
  border-color: #0a0;
  color: #0a0;
}

.btn-edit {
  border-color: #0077cc;
  color: #0077cc;
}

.btn-danger {
  border-color: #cc0000;
  color: #cc0000;
}

/* 📱 Адаптивные кнопки на мобилках */
@media (max-width: 768px) {
  .actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 24px;
    /* убираем паддинги, пусть работают внешние отступы контейнера */
  }

  .actions .btn {
    width: 100%;
    text-align: center;
  }

  /* ограничим ширину по родителю и выровняем */
  .actions {
    margin-left: 0;
    margin-right: 0;
  }
}

/* 🔷 Заголовок + кнопки */
.page-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.page-title {
  margin: 0;
  font-size: 24px;
  margin-bottom: 16px;
}

/* Кнопки: блок с обеими */
.page-header-buttons {
  display: flex;
  gap: 12px;
}

/* Мобилка: заголовок — на отдельной строке, кнопки — на одной строке под ним */
@media (max-width: 768px) {
  .page-header-flex {
    flex-direction: column;
    align-items: stretch;
  }

  .page-header-buttons {
    width: 100%;
    justify-content: space-between;
  }

  .page-header-buttons .btn {
    flex-grow: 0;
    width: auto;
  }
}

/* Для мобильных: три точки в правом верхнем углу карточки */
@media (max-width: 768px) {
  .task-table tr {
    position: relative;
  }

  .task-menu-wrapper {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
  }

  .task-menu-cell {
    margin-top: 0;
    text-align: right;
  }

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

  .menu-dots {
    padding: 0 4px;
    font-size: 20px;
  }
}