.tickets-page {
    display: flex;
    height: calc(100vh - 80px);
    background: #f8f9fa;
    margin: 0;
    padding: 0;
}

/* Левая колонка */
.tickets-sidebar {
    width: 350px;
    background: white;
    border-right: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tickets-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.tickets-header h2 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 1.5rem;
}

.new-ticket-btn {
    width: 100%;
    padding: 10px;
    background: #0d6efd;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.new-ticket-btn:hover {
    background: #0b5ed7;
}

.tickets-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.ticket-item {
    padding: 15px;
    border-radius: 8px;
    background: #f8f9fa;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.ticket-item:hover {
    background: #e9ecef;
}

.ticket-item.active {
    background: #e3f2fd;
    border-left: 4px solid #0d6efd;
}

.ticket-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.ticket-number {
    font-weight: 600;
    color: #495057;
}

.ticket-item-subject {
    font-weight: 500;
    color: #212529;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ticket-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #6c757d;
}

.ticket-has-response {
    color: #0d6efd;
}

/* Правая колонка */
.ticket-conversation {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    overflow: hidden;
}

.conversation-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    background: white;
}

.conversation-title {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.conversation-title h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.25rem;
}

.conversation-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #666;
    font-size: 14px;
}

.conversation-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.message {
    max-width: 80%;
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 12px;
    position: relative;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.message-author {
    font-weight: 500;
}

.message-time {
    color: #6c757d;
}

.user-message {
    background: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.admin-message {
    background: #e3f2fd;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.message-content {
    color: #212529;
    line-height: 1.5;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.conversation-reply {
    padding: 20px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.reply-input {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 10px;
    resize: vertical;
    font-family: inherit;
}

.reply-btn {
    padding: 10px 20px;
    background: #0d6efd;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.reply-btn:hover {
    background: #0b5ed7;
}

.ticket-closed-message {
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 10px;
}

.no-active-ticket {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.empty-state {
    text-align: center;
    color: #6c757d;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
}

.empty-state h3 {
    margin: 0 0 10px 0;
    color: #2c3e50;
}

.empty-state p {
    margin: 0;
}

/* Статусы */
.ticket-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-new {
    background: #e3f2fd;
    color: #0d47a1;
}

.status-in_progress {
    background: #fff3e0;
    color: #e65100;
}

.status-resolved {
    background: #e8f5e9;
    color: #1b5e20;
}

.status-closed {
    background: #eeeeee;
    color: #424242;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    margin: 50px auto;
    padding: 20px;
}

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

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
}

.close {
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #2c3e50;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-family: inherit;
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.form-actions {
    text-align: right;
    margin-top: 20px;
}

.submit-btn {
    padding: 10px 20px;
    background: #0d6efd;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.submit-btn:hover {
    background: #0b5ed7;
}

/* Адаптивность */
@media (max-width: 768px) {
    .tickets-page {
        flex-direction: column;
        height: auto;
    }

    .tickets-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
    }

    .ticket-conversation {
        height: calc(100vh - 300px);
    }

    .message {
        max-width: 100%;
    }
}

.delete-ticket-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

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

.delete-ticket-btn i {
    font-size: 12px;
}