/* Sidebar */
#sidebar {
    width: 240px;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

#main-content {
    margin-left: 240px;
    min-height: 100vh;
    background: #f5f7fa;
}

#sidebar .nav-link:hover {
    color: #fff !important;
    background: rgba(255,255,255,0.08);
    border-radius: 6px;
}

#sidebar .nav-link.active {
    color: #fff !important;
    background: rgba(255,255,255,0.12);
    border-radius: 6px;
}

/* Chat */
.chat-container {
    max-height: calc(100vh - 320px);
    min-height: 300px;
    overflow-y: auto;
    padding: 1rem;
}

.chat-message {
    max-width: 75%;
    margin-bottom: 1rem;
}

.chat-message.user-message {
    margin-right: auto;
}

.chat-message.admin-message {
    margin-left: auto;
}

.chat-message .bubble {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    position: relative;
    word-wrap: break-word;
}

.chat-message.user-message .bubble {
    background: #e9ecef;
    border-bottom-left-radius: 4px;
}

.chat-message.admin-message .bubble {
    background: #0d6efd;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-message .meta {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 4px;
}

.chat-message.admin-message .meta {
    text-align: right;
}

/* Attachments */
.attachment-preview {
    display: inline-block;
    margin: 4px;
    position: relative;
}

.attachment-preview img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    object-fit: cover;
}

.attachment-file {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
    margin: 4px;
    text-decoration: none;
    color: inherit;
}

.attachment-file:hover {
    background: rgba(0,0,0,0.08);
}

/* Forwarded message wrapper */
.forwarded-wrapper {
    background: rgba(0,0,0,0.04);
    border-left: 3px solid #0d6efd;
    border-radius: 6px;
    padding: 6px 10px;
    margin-bottom: 6px;
}

.admin-message .forwarded-wrapper {
    background: rgba(255,255,255,0.1);
    border-left-color: rgba(255,255,255,0.5);
}

.forward-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #6c757d;
}

.admin-message .forward-header {
    color: rgba(255,255,255,0.7);
}

.forward-info-btn {
    background: none;
    border: none;
    padding: 0 2px;
    color: inherit;
    opacity: 0.5;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
}

.forward-info-btn:hover {
    opacity: 1;
}

/* Attachment file in admin bubble — fix contrast */
.admin-message .attachment-file {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.admin-message .attachment-file:hover {
    background: rgba(255,255,255,0.25);
}

.admin-message .attachment-file .text-muted {
    color: rgba(255,255,255,0.7) !important;
}

/* Audio in admin bubble */
.admin-message .attachment-audio .text-muted {
    color: rgba(255,255,255,0.7) !important;
}

/* Reply context */
.reply-context {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 0.8rem;
    color: #6c757d;
}

.reply-context .reply-bar {
    width: 3px;
    background: #0d6efd;
    border-radius: 2px;
    flex-shrink: 0;
}

.reply-context .reply-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-message .reply-context {
    color: rgba(255,255,255,0.7);
}

.admin-message .reply-context .reply-bar {
    background: rgba(255,255,255,0.5);
}

/* Sticker */
.attachment-sticker img {
    max-width: 150px;
    max-height: 150px;
}

/* Video note (Telegram round video) */
.video-note-circle {
    border-radius: 50% !important;
    width: 200px;
    height: 200px;
    object-fit: cover;
}

/* Audio player */
.attachment-audio audio {
    display: block;
    width: 100%;
    max-width: 280px;
}

/* New message indicator */
.new-msg-indicator {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #0d6efd;
    color: #fff;
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 10;
    white-space: nowrap;
}

.new-msg-indicator:hover {
    background: #0b5ed7;
}

/* Drop zone */
.drop-zone {
    border: 2px dashed transparent;
    transition: all 0.2s ease;
    border-radius: 8px;
}

.drop-zone.drag-over {
    border-color: #0d6efd;
    background: rgba(13,110,253,0.05);
}

.upload-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
}

.upload-preview-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #e9ecef;
    border-radius: 20px;
    font-size: 0.85rem;
}

.upload-preview-item .remove-file {
    cursor: pointer;
    color: #dc3545;
    font-weight: bold;
}

/* Tracking badges */
.tracking-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Cards */
.stat-card {
    border: none;
    border-radius: 12px;
    transition: transform 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

/* Ticket list */
.ticket-row {
    transition: background 0.15s ease;
    cursor: pointer;
}

.ticket-row:hover {
    background: #f0f4ff;
}

/* Integration cards */
.integration-card {
    border-radius: 12px;
    border: 1px solid #e9ecef;
    transition: box-shadow 0.2s ease;
}

.integration-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Report */
.report-content {
    line-height: 1.7;
}

.report-content h1, .report-content h2, .report-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.report-content ul, .report-content ol {
    padding-left: 1.5rem;
}

/* Mobile */
@media (max-width: 991.98px) {
    #sidebar {
        transform: translateX(-100%);
    }
    #sidebar.show {
        transform: translateX(0);
    }
    #main-content {
        margin-left: 0;
    }
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        display: none;
    }
    .sidebar-backdrop.show {
        display: block;
    }
}

/* Public form */
.public-form-container {
    max-width: 600px;
    margin: 2rem auto;
}
