/* Общие стили для страницы */
body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f4f5f7;
    color: #333;
}

/* Стили для заголовков */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: #444;
    margin: 20px 0;
    text-align: center;
}

h1 {
    font-size: 24px;
    margin-bottom: 20px;
}

/* Стили для ссылок */
a {
    color: #0079bf;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #0056b3;
}

/* Стили для контейнера */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.header h1 {
    margin: 0;
    font-size: 24px;
}

/* Стили для кнопки "Добавить тикет" */
.add-ticket {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.add-ticket-btn {
    padding: 10px 20px;
    background-color: #0079bf;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.add-ticket-btn:hover {
    background-color: #0056b3;
}

/* Стили для контейнера тикетов */

.tickets-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Стили для каждого отдельного тикета */
.ticket {
    display: flex;
    flex-direction: column; 
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
}

.ticket:hover {
    background-color: #f0f2f5;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Новый контейнер для элементов заголовка */
.ticket-header {
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 10px;
}

/* Стили для чекбокса статуса */
.ticket-status {
    flex-shrink: 0;
    margin-right: 15px;
}

.status-indicator {
    width: 20px;
    height: 20px;
}

/* Стили для информации о тикете */

.ticket-info {
    flex-grow: 1;
    display: flex;
    justify-content: space-between;
    margin-right: 20px;
}

.ticket-name {
    font-weight: 600;
    font-size: 16px;
}

.ticket-date {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
}

/* Стили для кнопок действий */
.ticket-actions {
    flex-shrink: 0;
    display: flex;
    gap: 5px;
}

.edit-btn, .delete-btn {
    background: #f4f5f7;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.edit-btn:hover {
    background-color: #d1d8e0;
}

.delete-btn:hover {
    background-color: #ff6347;
    color: #fff;
}

/* Общие стили для всех модальных окон */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

/* Скрыть модальное окно */
.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-form {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    width: 400px;
    max-width: 90%;
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

/* Анимация при скрытии */
.modal-overlay.hidden .modal-form {
    transform: scale(0.9);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    margin: 0;
    font-size: 20px;
    color: #444;
}

/* Объединяем стили для кнопок закрытия в обоих модалках */
.close-btn, .close-btn-delete {
    background: none;
    border: none;
    font-size: 24px;
    color: #888;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease;
}

.close-btn:hover, .close-btn-delete:hover {
    color: #000;
    transform: rotate(90deg);
}

.modal-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

/* Стили для полей ввода в модальном окне */

.modal-body input,
.modal-body textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.modal-body textarea {
    resize: vertical;
    min-height: 100px;
    max-height: 150px;
}

.modal-body input:hover,
.modal-body textarea:hover {
    border-color: #999;
    box-shadow: 0 0 0 2px rgba(0, 121, 191, 0.1);
}

.modal-body input:focus,
.modal-body textarea:focus {
    outline: none;
    border-color: #0079bf;
    box-shadow: 0 0 0 3px rgba(0, 121, 191, 0.2);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* Кнопки в модальном окне добавления/редактирования */
.cancel-btn, .ok-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.cancel-btn {
    background: #f0f0f0;
    color: #333;
}

.cancel-btn:hover {
    background: #dcdcdc;
}

.ok-btn {
    background: #0079bf;
    color: #fff;
}

.ok-btn:hover {
    background: #0056b3;
}

/* Стили для модального окна удаления */
.modal-delete .modal-title {
    margin-right: auto;
}

.modal-delete .modal-body {
    text-align: left;
}

.modal-delete .modal-body p {
    margin: 0;
}

.modal-delete .modal-footer {
    justify-content: flex-end;
}

.delete-ticket-name {
    font-weight: bold;
}

/* Стили для кнопок в модальном окне удаления */
.cancel-btn-delete, .delete-btn-modal {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.cancel-btn-delete {
    background: #f0f0f0;
    color: #333;
}

.cancel-btn-delete:hover {
    background: #dcdcdc;
}

.delete-btn-modal {
    background: #dc3545; 
    color: #fff;
}

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

/* Стили для полного описания тикета */
.ticket-description {
    margin: 0;
    padding: 0 10px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, opacity 0.4s ease-out, padding 0.4s ease-out;
    background: #f8f9fa;
    color: #555;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 14px;
    border-radius: 4px;
}

.ticket-description.visible {
    max-height: 500px;
    opacity: 1;
    padding: 15px 20px; 
    margin: 10px 0; 
}

/* Стили для сообщения об отсутствии описания */
.ticket-description.empty-description {
    font-style: italic;
    color: #888;
}


/* Базовые стили для прелоадера */
.preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #f7f7f7;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

.preloader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none; /* Это важно, чтобы по блоку нельзя было кликнуть, когда он скрыт */
}

/* Стили для вращающегося элемента */
.spinner {
  width: 60px;
  height: 60px;
  border: 5px solid rgba(0, 0, 0, 0.1);
  border-top: 5px solid #2980b9;
  border-radius: 50%;
  animation: spin 3s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
}

/* Стили для сообщений */
.preloader-message {
  text-align: center;
  margin-top: 25px;
  color: #333;
}

.preloader-heading {
  font-size: 1.5em;
  font-weight: 600;
  margin: 0;
}

.preloader-subtext {
  font-size: 0.9em;
  color: #888;
  margin-top: 5px;
  font-weight: 400;
}

/* Анимация вращения */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
