:root {
    --az-primary: #5ab0ff;
    --az-primary-dark: #2e7bff;
    --az-primary-light: #1d2a3d;
    --az-secondary: #8e9bb5;
    --az-success: #31d28a;
    --az-warning: #f5b74c;
    --az-danger: #ff5c7c;
    --az-bg: #080c15;
    --az-bg-dark: #02040a;
    --az-sidebar-bg: #111827;
    --az-surface: #151f2f;
    --az-surface-alt: #1c2638;
    --az-sidebar-width: 260px;
    --az-chat-bg: #0f1724;
    --az-msg-out: linear-gradient(135deg, #4ea3ff, #2f6be9);
    --az-msg-out-text: #f8fbff;
    --az-msg-in: #1f2a3d;
    --az-msg-in-text: #e2e8f0;
    --az-msg-system: #233046;
    --az-border: #1f2a3d;
    --az-text: #f4f6fb;
    --az-text-muted: #9aa7c2;
    --az-radius: 10px;
    --az-radius-sm: 6px;
    --az-shadow: 0 12px 24px rgba(3,7,18,0.45);
    --az-shadow-lg: 0 20px 40px rgba(3,7,18,0.55);
    --az-transition: 0.2s ease;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 13px;
    color: var(--az-text);
    background: var(--az-bg);
    overflow: hidden;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2c374b; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3d4b66; }

/* ===== LOGIN ===== */
.az-login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #081426 0%, #102244 60%, #0b161f 100%);
    padding: 20px;
}

.az-login-card {
    background: var(--az-surface);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--az-shadow-lg);
}

.az-login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.az-login-logo i {
    font-size: 36px;
    color: var(--az-primary);
}

.az-login-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--az-text);
    margin: 8px 0 4px;
}

.az-login-logo p {
    color: var(--az-text-muted);
    font-size: 12px;
    margin: 0;
}

/* ===== BUTTONS ===== */
.az-btn-primary {
    background: var(--az-primary);
    border-color: var(--az-primary);
    color: #fff;
    border-radius: var(--az-radius-sm);
    font-weight: 600;
    transition: var(--az-transition);
}

.az-btn-primary:hover {
    background: var(--az-primary-dark);
    border-color: var(--az-primary-dark);
    color: #fff;
}

.az-btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--az-secondary);
    transition: var(--az-transition);
}

.az-btn-icon:hover {
    background: var(--az-border);
    color: var(--az-primary);
}

/* ===== APP LAYOUT ===== */
#az-app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ===== SIDEBAR ===== */
.az-sidebar {
    width: var(--az-sidebar-width);
    min-width: var(--az-sidebar-width);
    background: var(--az-sidebar-bg);
    border-right: 1px solid var(--az-border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    z-index: 1000;
    transition: var(--az-transition);
}

.az-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--az-border);
}

.az-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--az-primary);
}

.az-logo i { font-size: 20px; }

.az-agent-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--az-border);
}

.az-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--az-primary-light);
    color: var(--az-primary);
    font-size: 18px;
    flex-shrink: 0;
}

.az-avatar-sm { width: 30px; height: 30px; font-size: 16px; }
.az-avatar-lg { width: 50px; height: 50px; font-size: 24px; }

.az-agent-details { flex: 1; min-width: 0; }

.az-agent-name {
    display: block;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.az-agent-status-selector select {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--az-border);
}

.az-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.az-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--az-text);
    text-decoration: none;
    font-size: 13px;
    transition: var(--az-transition);
    position: relative;
}

.az-nav-item:hover {
    background: rgba(90, 176, 255, 0.15);
    color: var(--az-primary);
}

.az-nav-item.active {
    background: rgba(90, 176, 255, 0.18);
    color: var(--az-primary);
    font-weight: 600;
    border-right: 3px solid var(--az-primary);
}

.az-nav-item i { font-size: 16px; width: 20px; text-align: center; }

.az-badge-count {
    margin-left: auto;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 10px;
}

.az-sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--az-border);
}

/* ===== MAIN ===== */
.az-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.az-topbar {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: var(--az-surface);
    border-bottom: 1px solid var(--az-border);
    gap: 8px;
}

.az-topbar-title {
    flex: 1;
    font-weight: 600;
    text-align: center;
    font-size: 14px;
}

/* ===== VIEWS ===== */
.az-view {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
}

.az-view.active { display: flex; }

.az-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--az-surface);
    border-bottom: 1px solid var(--az-border);
    flex-wrap: wrap;
    gap: 8px;
}

.az-panel-header h5 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

/* ===== CONVERSATIONS LAYOUT ===== */
.az-conversations-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.az-conv-list-panel {
    width: 320px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--az-border);
    background: var(--az-surface);
}

.az-conv-filters {
    margin-top: 4px;
}

.az-conv-search {
    padding: 8px 12px;
    border-bottom: 1px solid var(--az-border);
}

.az-conv-items {
    flex: 1;
    overflow-y: auto;
}

.az-conv-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--az-border);
    cursor: pointer;
    transition: var(--az-transition);
}

.az-conv-item:hover { background: rgba(255,255,255,0.03); }
.az-conv-item.active { background: rgba(74,143,255,0.15); }

.az-conv-item-body { flex: 1; min-width: 0; }

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

.az-conv-item-name {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.az-conv-item-time {
    font-size: 10px;
    color: var(--az-text-muted);
    white-space: nowrap;
    margin-left: 8px;
}

.az-conv-item-preview {
    font-size: 12px;
    color: var(--az-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.az-conv-item-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.az-conv-unread {
    background: var(--az-primary);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.az-conv-status-badge {
    font-size: 9px;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.az-status-pending { background: #fff3cd; color: #856404; }
.az-status-open { background: #d4edda; color: #155724; }
.az-status-resolved { background: #e2e3e5; color: #383d41; }

/* ===== CHAT PANEL ===== */
.az-chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--az-chat-bg);
    min-width: 0;
}

.az-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--az-surface);
    border-bottom: 1px solid var(--az-border);
    gap: 8px;
}

.az-chat-contact-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.az-chat-contact-details { min-width: 0; }

.az-chat-contact-name {
    display: block;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.az-chat-contact-phone {
    font-size: 11px;
    color: var(--az-text-muted);
}

.az-chat-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* ===== MESSAGES ===== */
.az-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.az-msg {
    max-width: 65%;
    padding: 8px 12px;
    border-radius: 18px;
    font-size: 12px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
}

.az-msg-sender {
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    display: block;
    width: 100%;
    transition: var(--az-transition);
    position: relative;
}

.az-msg-sender:hover {
    color: var(--az-primary) !important;
}

.az-msg-in .az-msg-sender {
    color: var(--az-primary);
}

/* Popover do participante */
.az-participant-popover {
    position: fixed;
    background: var(--az-surface-alt);
    border: 1px solid var(--az-border);
    border-radius: var(--az-radius);
    box-shadow: var(--az-shadow-lg);
    padding: 12px;
    min-width: 220px;
    max-width: 280px;
    z-index: 9999;
    animation: azFadeIn 0.15s ease;
}

.az-participant-popover::after {
    content: '';
    position: absolute;
    left: 16px;
    border: 8px solid transparent;
}

.az-participant-popover.az-popover-above::after {
    top: 100%;
    border-top-color: var(--az-surface-alt);
}

.az-participant-popover.az-popover-below::after {
    bottom: 100%;
    border-bottom-color: var(--az-surface-alt);
}

.az-participant-popover-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.az-participant-popover-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--az-primary-light);
    color: var(--az-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    overflow: hidden;
}

.az-participant-popover-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.az-participant-popover-info {
    flex: 1;
    min-width: 0;
}

.az-participant-popover-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--az-text);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.az-participant-popover-phone {
    font-size: 12px;
    color: var(--az-text-muted);
}

.az-participant-popover-actions {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--az-border);
}

.az-participant-popover-actions button {
    width: 100%;
}

.az-msg-in {
    background: var(--az-msg-in);
    color: var(--az-msg-in-text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: var(--az-shadow);
}

.az-msg-out {
    background: var(--az-msg-out);
    color: var(--az-msg-out-text);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.az-msg-bot {
    background: #e8f5e9;
    color: #1b5e20;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: var(--az-shadow);
}

.az-msg-system {
    background: var(--az-msg-system);
    color: var(--az-text-muted);
    align-self: center;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 12px;
    max-width: 80%;
}

.az-msg-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 2px;
    display: block;
    text-align: right;
}

.az-msg-in .az-msg-time,
.az-msg-bot .az-msg-time { text-align: left; }

.az-msg-media {
    max-width: 100%;
    border-radius: 12px;
    margin-bottom: 4px;
}

.az-msg-media img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 10px;
    cursor: pointer;
}

.az-msg-status {
    font-size: 10px;
    margin-left: 4px;
    cursor: default;
}

.az-msg-deleted {
    font-size: 13px;
    opacity: 0.65;
}

.az-reaction-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.az-reaction-badge {
    background: rgba(0,0,0,.07);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 13px;
    cursor: default;
}

/* ===== TYPING ===== */
.az-typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 16px 8px;
}

.az-typing-dots {
    display: flex;
    gap: 3px;
}

.az-typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--az-text-muted);
    animation: az-typing 1.2s infinite;
}

.az-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.az-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes az-typing {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1); }
}

.az-typing-text {
    font-size: 12px;
    color: var(--az-text-muted);
    font-style: italic;
}

/* ===== CHAT INPUT ===== */
.az-chat-input-area {
    background: var(--az-surface);
    border-top: 1px solid var(--az-border);
    padding: 8px 12px;
}

.az-chat-input-toolbar {
    display: flex;
    gap: 2px;
    margin-bottom: 4px;
}

.az-chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.az-chat-input-row textarea {
    resize: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    max-height: 120px;
    border: 1px solid var(--az-border);
}

.az-chat-input-row textarea:focus {
    border-color: var(--az-primary);
    box-shadow: 0 0 0 2px rgba(0,132,255,0.15);
}

.az-btn-send {
    width: 40px;
    height: 40px;
    border-radius: 50% !important;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ===== INFO PANEL ===== */
.az-info-panel {
    width: 320px;
    min-width: 280px;
    background: var(--az-surface);
    border-left: 1px solid var(--az-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.az-info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--az-border);
}

.az-info-header h6 { margin: 0; font-weight: 600; }

.az-info-body { padding: 16px; }

.az-info-body .az-info-section {
    margin-bottom: 20px;
}

.az-info-body .az-info-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--az-text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.az-info-body .az-info-value {
    font-size: 14px;
    margin-bottom: 8px;
}

/* ===== DATA CONTAINER (tables/cards) ===== */
.az-data-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.az-data-card {
    background: var(--az-surface-alt);
    border-radius: var(--az-radius);
    box-shadow: var(--az-shadow);
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: var(--az-transition);
}

.az-data-card:hover {
    box-shadow: var(--az-shadow-lg);
}

.az-data-card-body { flex: 1; min-width: 0; }

.az-data-card-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 2px;
}

.az-data-card-subtitle {
    font-size: 13px;
    color: var(--az-text-muted);
}

.az-data-card-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* ===== EMPTY STATE ===== */
.az-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--az-text-muted);
}

.az-empty-state i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.az-empty-state p {
    font-size: 14px;
    margin: 0;
}

/* ===== CONNECTION STATUS ===== */
.az-conn-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
}

.az-conn-connected { background: #d4edda; color: #155724; }
.az-conn-disconnected { background: #f8d7da; color: #721c24; }
.az-conn-waiting_qr { background: #fff3cd; color: #856404; }
.az-conn-connecting { background: #cce5ff; color: #004085; }
.az-conn-error { background: #f8d7da; color: #721c24; }

/* ===== FILTER BUTTONS ===== */
.az-filter-btn.active {
    font-weight: 600;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .az-sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        z-index: 2000;
        box-shadow: var(--az-shadow-lg);
    }

    .az-sidebar.open { left: 0; }

    .az-conv-list-panel {
        width: 100%;
        min-width: 100%;
    }

    .az-chat-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1500;
    }

    .az-info-panel {
        position: fixed;
        top: 0;
        right: -100%;
        height: 100vh;
        z-index: 1600;
        box-shadow: var(--az-shadow-lg);
        transition: var(--az-transition);
    }

    .az-info-panel.open { right: 0; }

    .az-msg { max-width: 85%; }
}

@media (min-width: 769px) {
    #az-back-to-list,
    #az-chat-back { display: none !important; }
}

/* ===== LOADING ===== */
.az-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.az-loading .spinner-border {
    width: 24px;
    height: 24px;
    border-width: 2px;
}

/* ===== MEDIA IN MESSAGES ===== */
.az-msg-media {
    margin-bottom: 4px;
}

.az-msg-media img {
    max-width: 280px;
    max-height: 280px;
    border-radius: 10px;
    cursor: pointer;
    object-fit: cover;
}

.az-msg audio {
    max-width: 260px;
    height: 36px;
}

.az-msg video {
    max-width: 300px;
    border-radius: 10px;
}

.az-msg a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: rgba(0,0,0,0.04);
    border-radius: 8px;
    color: var(--az-primary);
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 4px;
    word-break: break-all;
}

.az-msg a:hover {
    background: rgba(0,0,0,0.08);
}

/* ===== CHANNEL BADGE ===== */
.az-channel-badge {
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.az-conv-conn-name {
    font-size: 11px;
    color: var(--az-text-muted);
    margin-left: 6px;
    opacity: 0.8;
}

/* ===== CONVERSATION GROUP HEADERS ===== */
.az-conv-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--az-surface);
    border-bottom: 1px solid var(--az-border);
    font-size: 12px;
    font-weight: 600;
    color: var(--az-text-muted);
    position: sticky;
    top: 0;
    z-index: 5;
}

.az-conv-group-channel {
    font-size: 16px;
    flex-shrink: 0;
}

.az-conv-group-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.az-conv-group-conn {
    font-size: 10px;
    font-weight: 400;
    color: var(--az-text-muted);
    opacity: 0.7;
}

.az-conv-group-count {
    background: var(--az-border);
    color: var(--az-text-muted);
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* ===== ANIMATIONS ===== */
.az-fade-in {
    animation: azFadeIn 0.3s ease;
}

@keyframes azFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== IMAGE MODAL WITH ZOOM ===== */
.az-image-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.92);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    animation: azFadeIn 0.2s ease;
}

.az-image-modal-overlay img {
    max-width: 92vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    transition: transform 0.3s ease;
    cursor: grab;
    user-select: none;
    -webkit-user-drag: none;
}

.az-image-modal-overlay img.az-zoomed {
    cursor: grabbing;
    max-width: none;
    max-height: none;
}

.az-image-modal-close {
    position: absolute;
    top: 16px; right: 20px;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 24px;
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    z-index: 10001;
    transition: background 0.2s;
}

.az-image-modal-close:hover { background: rgba(255,255,255,0.3); }

.az-image-modal-zoom-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10001;
}

.az-image-modal-zoom-controls button {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 18px;
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.az-image-modal-zoom-controls button:hover {
    background: rgba(255,255,255,0.3);
}

/* ===== AUDIO PLAYER STYLED ===== */
.az-audio-player {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 220px;
    max-width: 280px;
    padding: 4px 0;
}

.az-audio-play-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 16px;
    transition: background 0.2s;
}

.az-msg-in .az-audio-play-btn {
    background: rgba(90,176,255,0.25);
    color: var(--az-primary);
}

.az-audio-play-btn:hover { background: rgba(255,255,255,0.25); }

.az-audio-info {
    flex: 1;
    min-width: 0;
}

.az-audio-waveform {
    height: 28px;
    display: flex;
    align-items: center;
    gap: 1.5px;
    cursor: pointer;
    position: relative;
}

.az-audio-waveform-bar {
    width: 3px;
    border-radius: 2px;
    background: rgba(255,255,255,0.25);
    transition: background 0.15s;
}

.az-msg-in .az-audio-waveform-bar { background: rgba(155,175,205,0.35); }

.az-audio-waveform-bar.az-played {
    background: rgba(255,255,255,0.7);
}

.az-msg-in .az-audio-waveform-bar.az-played {
    background: var(--az-primary);
}

.az-audio-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 2px;
}

/* ===== DOCUMENT CARD ===== */
.az-doc-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(0,0,0,0.08);
    border-radius: 10px;
    margin-bottom: 4px;
    min-width: 200px;
    max-width: 280px;
    text-decoration: none !important;
    color: inherit !important;
    transition: background 0.2s;
    cursor: pointer;
}

.az-msg-in .az-doc-card { background: rgba(255,255,255,0.06); }
.az-msg-out .az-doc-card { background: rgba(0,0,0,0.12); }
.az-doc-card:hover { background: rgba(255,255,255,0.12); }

.az-doc-icon {
    width: 40px; height: 40px;
    border-radius: 8px;
    background: rgba(90,176,255,0.15);
    color: var(--az-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.az-doc-icon.az-doc-pdf { background: rgba(255,70,70,0.15); color: #ff4646; }

.az-doc-info {
    flex: 1;
    min-width: 0;
}

.az-doc-name {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.az-doc-meta {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 1px;
}

.az-doc-action {
    font-size: 18px;
    opacity: 0.5;
    flex-shrink: 0;
}

/* ===== MUTED CONTACTS ===== */
.az-conv-section-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: var(--az-bg-dark);
    border-bottom: 1px solid var(--az-border);
    font-size: 11px;
    font-weight: 600;
    color: var(--az-text-muted);
    cursor: pointer;
    user-select: none;
}

.az-conv-section-divider i {
    font-size: 12px;
    transition: transform 0.2s;
}

.az-conv-section-divider.collapsed i.bi-chevron-down {
    transform: rotate(-90deg);
}

.az-conv-section-count {
    margin-left: auto;
    background: var(--az-border);
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 10px;
}

.az-conv-item.az-muted {
    opacity: 0.55;
}

.az-conv-item.az-muted:hover {
    opacity: 0.75;
}

.az-mute-btn {
    font-size: 12px;
    opacity: 0.5;
    cursor: pointer;
    transition: opacity 0.2s;
}

.az-mute-btn:hover { opacity: 1; }

/* ===== HIDDEN CONTACTS ===== */
.az-btn-hidden-toggle {
    position: relative;
    color: var(--az-text-muted);
    border: 1px solid var(--az-border);
    background: transparent;
    font-size: 13px;
    padding: 2px 8px;
}

.az-btn-hidden-toggle:hover {
    color: var(--az-text);
    border-color: var(--az-text-muted);
}

.az-hidden-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--az-text-muted);
    color: var(--az-surface);
    font-size: 9px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    padding: 0 4px;
    margin-left: 4px;
}

.az-hidden-divider {
    border-top: 1px dashed var(--az-border);
    opacity: 0.6;
}

.az-hidden-divider:hover {
    opacity: 1;
}

#az-hidden-section .az-conv-item {
    opacity: 0.5;
    border-left: 3px solid var(--az-border);
}

#az-hidden-section .az-conv-item:hover {
    opacity: 0.8;
}

/* ===== CONNECTION FILTER DROPDOWN ===== */
.az-conn-filter {
    margin-top: 6px;
}

.az-conn-filter select {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid var(--az-border);
    background: var(--az-surface-alt);
    color: var(--az-text);
}

/* ===== CONTACT AVATAR IN LIST AND CHAT ===== */
.az-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* ===== VIDEO PLAYER ===== */
.az-video-wrapper {
    position: relative;
    max-width: 320px;
    border-radius: 10px;
    overflow: hidden;
    background: #000;
    cursor: pointer;
}

.az-video-wrapper video {
    width: 100%;
    max-width: 320px;
    display: block;
    border-radius: 10px;
}

.az-video-thumb {
    position: relative;
    max-width: 320px;
    border-radius: 10px;
    overflow: hidden;
    background: #111;
    cursor: pointer;
}

.az-video-thumb video {
    width: 100%;
    display: block;
    border-radius: 10px;
    pointer-events: none;
}

.az-video-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.35);
    transition: background 0.2s;
}

.az-video-thumb:hover .az-video-play-overlay {
    background: rgba(0,0,0,0.5);
}

.az-video-play-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #222;
    box-shadow: 0 2px 12px rgba(0,0,0,0.4);
    transition: transform 0.15s;
}

.az-video-thumb:hover .az-video-play-btn {
    transform: scale(1.08);
}

/* Video modal lightbox */
.az-video-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: azFadeIn 0.15s ease;
}

.az-video-modal-overlay video {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.az-video-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10000;
}

.az-video-modal-close:hover { background: rgba(255,255,255,0.3); }

/* ===== PDF SIDEBAR PANEL ===== */
.az-pdf-sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(700px, 100vw);
    height: 100vh;
    background: var(--az-surface, #1e2130);
    z-index: 9990;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 30px rgba(0,0,0,0.4);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.az-pdf-sidebar.az-pdf-open {
    right: 0;
}

.az-pdf-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9989;
    background: rgba(0,0,0,0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.az-pdf-sidebar-backdrop.az-pdf-open {
    opacity: 1;
    pointer-events: auto;
}

.az-pdf-sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--az-border);
    flex-shrink: 0;
    min-height: 56px;
}

.az-pdf-sidebar-title {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--az-text);
}

.az-pdf-sidebar-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.az-pdf-sidebar-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: none;
    background: rgba(255,255,255,0.08);
    color: var(--az-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

.az-pdf-sidebar-btn:hover { background: rgba(255,255,255,0.15); }

.az-pdf-sidebar-body {
    flex: 1;
    overflow: hidden;
    background: #525659;
}

.az-pdf-sidebar-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.az-pdf-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: #ccc;
    font-size: 13px;
}

/* ===== DOCUMENT CARD — extended ===== */
.az-doc-card.az-doc-word   .az-doc-icon { background: rgba(43,107,234,0.15); color: #2b6bea; }
.az-doc-card.az-doc-excel  .az-doc-icon { background: rgba(33,115,70,0.15);  color: #217346; }
.az-doc-card.az-doc-ppt    .az-doc-icon { background: rgba(211,71,37,0.15);  color: #d34725; }
.az-doc-card.az-doc-zip    .az-doc-icon { background: rgba(255,180,0,0.15);  color: #f5b800; }
.az-doc-card.az-doc-audio  .az-doc-icon { background: rgba(90,176,255,0.15); color: var(--az-primary); }
.az-doc-card.az-doc-video  .az-doc-icon { background: rgba(130,100,255,0.15);color: #8264ff; }


/* ===== LOAD MORE — infinite scroll ===== */
.az-conv-load-more {
    text-align: center;
    padding: 12px 0 16px;
    cursor: pointer;
}
.az-conv-load-more span {
    font-size: 12px;
    color: var(--az-primary);
    opacity: 0.75;
    border-bottom: 1px dashed currentColor;
}
.az-conv-load-more:hover span { opacity: 1; }
