/* ========== СТИЛИ ДЛЯ ТИКЕТОВ ПОДДЕРЖКИ ========== */

.support-tickets-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #f8f9fa;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.support-tickets-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    gap: 12px;
    flex-shrink: 0;
}

.support-tickets-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    flex: 1;
    text-align: center;
}

.support-back-btn,
.ticket-back-btn,
.ticket-toggle-btn {
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
}

.support-back-btn:hover,
.ticket-back-btn:hover,
.ticket-toggle-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.support-new-btn {
    padding: 8px 16px;
    background: #dd1847;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
}

.support-new-btn:hover {
    background: #c1163d;
    box-shadow: 0 2px 8px rgba(221, 24, 71, 0.3);
}

.support-tickets-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    min-height: 0;
}

/* Список тикетов */
.support-tickets-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.support-loading {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
}

.support-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.support-ticket-item {
    padding: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
}

.support-ticket-item:hover {
    border-color: #dd1847;
    box-shadow: 0 2px 8px rgba(221, 24, 71, 0.1);
}

.ticket-subject {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
    line-height: 1.4;
    word-break: break-word;
}

.ticket-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.ticket-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.ticket-status.open {
    background: #e3f2fd;
    color: #1976d2;
}

.ticket-status.waiting_reply {
    background: #fff3e0;
    color: #f57c00;
}

.ticket-status.closed {
    background: #e8f5e9;
    color: #388e3c;
}

.ticket-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #dd1847;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.ticket-date {
    font-size: 12px;
    color: #999;
}

.ticket-last-message {
    font-size: 13px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Переписка в тикете */
.support-ticket-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    min-width: 0;
}

.ticket-view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    gap: 12px;
    flex-shrink: 0;
}

.ticket-back-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    flex-shrink: 0;
}

.ticket-view-subject {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    flex: 1;
    word-break: break-word;
}

.ticket-toggle-btn {
    flex-shrink: 0;
    font-size: 13px;
}

.ticket-view-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fa;
}

.msg-support {
    align-self: flex-start;
    max-width: 70%;
    background: #fff;
    padding: 12px 16px;
    border-radius: 16px 16px 16px 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

.msg-user {
    align-self: flex-end;
    max-width: 70%;
    background: #dd1847;
    padding: 12px 16px;
    border-radius: 16px 16px 4px 16px;
}

.msg-author {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #999;
}

.msg-user .msg-author {
    color: rgba(255,255,255,0.7);
}

.msg-text {
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    color: #1a1a1a;
    white-space: pre-wrap;
}

.msg-user .msg-text {
    color: #fff;
}

.msg-time {
    font-size: 10px;
    margin-top: 4px;
    color: #999;
    text-align: right;
}

.msg-user .msg-time {
    color: rgba(255,255,255,0.7);
}

.ticket-view-input {
    display: flex;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
    flex-shrink: 0;
    align-items: flex-end;
}

.ticket-view-input textarea {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: all 0.2s;
    min-height: 44px;
    max-height: 120px;
    box-sizing: border-box;
}

.ticket-view-input textarea:focus {
    border-color: #dd1847;
    box-shadow: 0 0 0 3px rgba(221, 24, 71, 0.1);
}

.ticket-view-input button {
    width: 44px;
    height: 44px;
    background: #dd1847;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ticket-view-input button:hover:not(:disabled) {
    background: #c1163d;
    box-shadow: 0 2px 8px rgba(221, 24, 71, 0.3);
}

.ticket-view-input button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Модальное окно создания обращения */
.support-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.support-modal {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

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

.support-modal h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

.support-modal-header button {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    color: #999;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.support-modal-header button:hover {
    background: #f5f5f5;
}

.support-modal input,
.support-modal textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
    margin-bottom: 12px;
    box-sizing: border-box;
}

.support-modal input:focus,
.support-modal textarea:focus {
    border-color: #dd1847;
    box-shadow: 0 0 0 3px rgba(221, 24, 71, 0.1);
}

.support-modal textarea {
    resize: vertical;
    min-height: 100px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.modal-actions button {
    padding: 10px 20px;
    border: 1px solid #e0e0e0;
    background: #fff;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s;
    font-family: inherit;
}

.modal-actions button:last-child {
    background: #dd1847;
    color: #fff;
    border-color: #dd1847;
    font-weight: 600;
}

.modal-actions button:last-child:hover:not(:disabled) {
    background: #c1163d;
}

.modal-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .msg-support,
    .msg-user {
        max-width: 85%;
    }
    
    .support-tickets-header {
        padding: 12px 16px;
    }
    
    .support-tickets-header h2 {
        font-size: 16px;
    }
    
    .support-new-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .ticket-view-header {
        padding: 12px 16px;
    }
    
    .ticket-view-messages {
        padding: 16px;
    }
    
    .ticket-view-input {
        padding: 12px 16px;
    }
}
/* Layout: тикеты слева, чат справа */
.support-tickets-content {
    display: flex;
    flex-direction: row;
}

.support-tickets-list {
    width: 340px;
    min-width: 340px;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
}

.support-ticket-view {
    flex: 1;
    min-width: 0;
}

.ticket-empty-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
}

/* Кнопка прикрепления файла */
.attach-btn {
    width: 44px;
    height: 44px;
    background: transparent;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    flex-shrink: 0;
    transition: all 0.2s;
}

.attach-btn:hover {
    background: #f5f5f5;
}

.send-btn {
    width: 44px;
    height: 44px;
    background: #dd1847;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.send-btn:hover:not(:disabled) {
    background: #c1163d;
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.file-preview {
    padding: 8px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: #666;
}

.file-preview button {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    font-size: 16px;
}

.msg-file {
    margin-bottom: 6px;
}

.file-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #dd1847;
    text-decoration: none;
    font-size: 13px;
}

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

/* Мобильная версия */
@media (max-width: 768px) {
    .support-tickets-list {
        width: 100%;
        min-width: auto;
        border-right: none;
    }
    
    .support-ticket-view {
        display: flex;
    }
    
    .support-ticket-view.mobile-hidden {
        display: none;
    }
    
    .msg-support,
    .msg-user {
        max-width: 85%;
    }
}
.support-create-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #dd1847;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
    flex-shrink: 0;
}

.support-create-btn:hover {
    background: #c1163d;
    box-shadow: 0 2px 8px rgba(221, 24, 71, 0.3);
}

.support-create-btn svg {
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .support-create-btn span {
        display: none;
    }
    
    .support-create-btn {
        width: 36px;
        height: 36px;
        padding: 0;
        justify-content: center;
        border-radius: 10px;
    }
}