body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7f9;
    color: #333;
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.tickets-container {
    display: flex;
    gap: 20px;
}

.ticket-list {
    flex: 1;
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ticket-list h2 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.ticket-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 400px;
    overflow-y: auto;
}

.ticket-list li {
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

.ticket-list li:hover {
    background-color: #f0f0f0;
}

.ticket-list li.active {
    background-color: #e0eafc;
}

.ticket-view {
    margin-top: 20px;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Новые стили для расположения блоков */
.ticket-details-layout {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

#profile-info-container {
    flex: 0 0 280px; /* Фиксированная ширина для блока профиля */
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
    height: fit-content; /* Высота по содержимому */
}

#profile-info-container h3 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
    font-size: 1.1em;
}

#profile-info-container ul {
    padding: 0;
    margin: 0;
    list-style-type: none;
}

#profile-info-container li {
    padding: 4px 0;
}
/* --- */

#messages-container {
    flex: 1; /* Занимает оставшееся место */
    height: 400px;
    overflow-y: scroll;
    border: 1px solid #ccc;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 4px;
}

.message {
    padding: 8px 12px;
    border-radius: 18px;
    margin-bottom: 8px;
    max-width: 70%;
    word-wrap: break-word;
}

.message.user {
    background-color: #e1ffc7;
    align-self: flex-start;
    margin-right: auto;
}

.message.support {
    background-color: #f1f0f0;
    align-self: flex-end;
    margin-left: auto;
}

.reply-form textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    height: 80px;
    margin-bottom: 10px;
}

.ticket-actions button, .reply-form button {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background-color: #007bff;
    color: white;
}

.ticket-actions button:hover, .reply-form button:hover {
    background-color: #0056b3;
}

.hidden {
    display: none;
}

.date-red {
    color: red;
    font-weight: bold;
}
.date-yellow {
    color: orange;
}

.message-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    margin-top: 5px;
    display: block;
    object-fit: cover;
}

/* Добавьте это в конец вашего медиа-запроса для мобильных устройств */
@media (max-width: 768px) {
    .tickets-container {
        flex-direction: column;
    }

    .ticket-list { /* Замените .ticket-list-container на .ticket-list, если вы его используете */
        width: 100%;
        margin-bottom: 20px;
    }

    /* Адаптация для блока с деталями тикета */
    .ticket-details-layout {
        flex-direction: column;
    }

    #profile-info-container {
        flex-basis: auto; /* Сброс ширины */
        margin-bottom: 15px;
    }
    /* --- */

    /* Новые стили для сворачивания */
    #closed-tickets-container h2 {
        cursor: pointer;
        position: relative;
    }

    #closed-tickets-container h2::after {
        content: '[+]';
        position: absolute;
        right: 15px;
        font-weight: normal;
    }

    #closed-tickets-container:not(.collapsed) h2::after {
        content: '[-]';
    }

    #closed-tickets-container.collapsed ul {
        display: none;
    }
}

/* Добавьте эти стили в ваш файл style.css */
.profile-info-table {
    width: 100%;
    border-collapse: collapse;
}

.profile-info-table td {
    padding: 4px 0;
}

.profile-info-value {
    text-align: right;
    font-weight: bold;
    padding-left: 10px;
}

/* Добавьте эти стили в конец файла */
#templates-container {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

#templates-container select {
    flex: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
}

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

#show-stats-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background-color: #6c757d;
    color: white;
    font-size: 0.9em;
}

#show-stats-btn:hover {
    background-color: #5a6268;
}

.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    /* overflow: auto;  <-- Удаляем эту строку */
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Добавляем это правило, чтобы гарантировать скрытие модального окна */
.modal.hidden {
    display: none;
}

.modal-content {
    background-color: #fefefe;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 8px;
    position: relative;
}

.close-modal-btn {
    color: #aaa;
    position: absolute; /* Изменено для точного позиционирования */
    top: 10px;         /* Отступ сверху */
    right: 15px;        /* Отступ справа */
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;     /* Убираем лишнюю высоту */
}

.close-modal-btn:hover,
.close-modal-btn:focus {
    color: black;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.stats-table th, .stats-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
}

.stats-table th {
    background-color: #f2f2f2;
}

.signature-options {
    margin-bottom: 15px;
}

#channels-list-container {
    margin-top: 20px;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#channels-list-container h3 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.channels-table-wrapper {
    max-height: 400px;
    overflow-y: auto;
}

.channels-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.channels-table th, .channels-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
    font-size: 0.9em;
}

.channels-table th {
    background-color: #f2f2f2;
    position: sticky;
    top: 0;
    z-index: 1;
}

.channels-table td a {
    color: #007bff;
    text-decoration: none;
}

.channels-table td a:hover {
    text-decoration: underline;
}

.vip-ticket {
    background-color: #fffbe6 !important; /* Светло-желтый фон */
    border-left: 4px solid #ffd700; /* Золотая рамка слева */
    font-weight: bold;
}

.vip-icon {
    color: #ffd700; /* Золотой цвет */
    margin-left: 8px;
    font-size: 1.2em;
    cursor: default;
}
