/* ========================================
   Telegram Support Dashboard
   Authentic Telegram Desktop Dark Theme
   ======================================== */

:root {
    /* Telegram Desktop Dark Palette */
    --tg-bg: #0e1621;
    --tg-sidebar: #17212b;
    --tg-sidebar-hover: #202b36;
    --tg-sidebar-active: #2b5278;
    --tg-header: #17212b;
    --tg-input-bg: #17212b;
    --tg-bubble-out: #2b5278;
    --tg-bubble-in: #182533;
    --tg-bubble-ai: #1e2a4a;
    --tg-text: #f5f5f5;
    --tg-text-secondary: #6d7f8f;
    --tg-text-meta: #5d6e7e;
    --tg-accent: #5eb5f7;
    --tg-accent-hover: #4da3e5;
    --tg-unread: #5eb5f7;
    --tg-border: #0e1621;
    --tg-green: #4dcd5e;
    --tg-red: #e55e5e;
    --tg-purple: #9b59b6;
    --tg-ai-accent: #8b5cf6;
    --tg-scrollbar: rgba(255, 255, 255, 0.12);
    --tg-scrollbar-hover: rgba(255, 255, 255, 0.2);
    --tg-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--tg-bg);
    color: var(--tg-text);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--tg-scrollbar);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--tg-scrollbar-hover);
}

/* ========================================
   LOGIN SCREEN
   ======================================== */

.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, #0d1117 0%, #161b22 50%, #0e1621 100%);
    position: relative;
    overflow: hidden;
}

.login-screen::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(94, 181, 247, 0.06) 0%, transparent 70%);
    top: -200px;
    right: -200px;
    border-radius: 50%;
}

.login-screen::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.05) 0%, transparent 70%);
    bottom: -150px;
    left: -100px;
    border-radius: 50%;
}

.login-container {
    background: rgba(23, 33, 43, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 48px 40px;
    width: 420px;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    position: relative;
    z-index: 1;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--tg-accent), var(--tg-ai-accent));
    border-radius: 16px;
    color: #fff;
    margin-bottom: 16px;
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
}

.login-subtitle {
    font-size: 13px;
    color: var(--tg-text-secondary);
    line-height: 1.5;
}

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--tg-text-secondary);
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tg-text-meta);
    pointer-events: none;
}

.form-group input {
    width: 100%;
    padding: 12px 14px 12px 44px;
    background: rgba(14, 22, 33, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: var(--tg-text);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    outline: none;
}

.form-group input:focus {
    border-color: var(--tg-accent);
    box-shadow: 0 0 0 3px rgba(94, 181, 247, 0.15);
}

.form-group input::placeholder {
    color: var(--tg-text-meta);
}

.form-hint {
    display: block;
    font-size: 11px;
    color: var(--tg-text-meta);
    margin-top: 6px;
}

.form-hint a {
    color: var(--tg-accent);
    text-decoration: none;
}

.btn-login {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, var(--tg-accent), #4a9de0);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.btn-login:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(94, 181, 247, 0.3);
}

.btn-login:active {
    transform: scale(0.98);
}

.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.login-error {
    background: rgba(229, 94, 94, 0.1);
    border: 1px solid rgba(229, 94, 94, 0.3);
    color: var(--tg-red);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-top: 16px;
    text-align: center;
}

/* ========================================
   CHAT DASHBOARD
   ======================================== */

.chat-dashboard {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 340px;
    min-width: 340px;
    background: var(--tg-sidebar);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--tg-border);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
}

.sidebar-brand svg {
    color: var(--tg-accent);
}

.sidebar-actions {
    display: flex;
    gap: 4px;
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--tg-text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.icon-btn:hover {
    background: var(--tg-sidebar-hover);
    color: var(--tg-text);
}

.icon-btn.ai-active {
    color: var(--tg-ai-accent);
    background: rgba(139, 92, 246, 0.15);
}

.sidebar-bot-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--tg-text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.bot-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tg-green);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.bot-name {
    font-weight: 500;
}

.ai-badge {
    background: linear-gradient(135deg, var(--tg-ai-accent), #6d28d9);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    letter-spacing: 0.5px;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 4px rgba(139, 92, 246, 0.3);
    }

    to {
        box-shadow: 0 0 12px rgba(139, 92, 246, 0.5);
    }
}

/* Super Admin */
.super-admin-toggle {
    margin-bottom: 12px !important;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--tg-text-secondary);
    cursor: pointer;
    user-select: none;
}

.toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #f0883e;
    cursor: pointer;
}

.bot-selector-wrap {
    padding: 6px 16px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.bot-selector {
    width: 100%;
    padding: 8px 10px;
    background: rgba(14, 22, 33, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: var(--tg-text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.bot-selector:focus {
    border-color: #f0883e;
}

.bot-selector option {
    background: var(--tg-sidebar);
    color: var(--tg-text);
}

.conv-bot-badge {
    display: inline-block;
    background: rgba(240, 136, 62, 0.15);
    color: #f0883e;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    margin-right: 4px;
    vertical-align: middle;
}

.sidebar-search {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar-search svg {
    color: var(--tg-text-meta);
    flex-shrink: 0;
}

.sidebar-search input {
    flex: 1;
    background: none;
    border: none;
    color: var(--tg-text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
}

.sidebar-search input::placeholder {
    color: var(--tg-text-meta);
}

/* Conversation List */
.conversation-list {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-left: 3px solid transparent;
}

.conversation-item:hover {
    background: var(--tg-sidebar-hover);
}

.conversation-item.active {
    background: var(--tg-sidebar-active);
    border-left-color: var(--tg-accent);
}

.conv-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
    text-transform: uppercase;
}

.conv-content {
    flex: 1;
    min-width: 0;
}

.conv-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.conv-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-time {
    font-size: 11px;
    color: var(--tg-text-meta);
    white-space: nowrap;
    flex-shrink: 0;
}

.conv-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 3px;
}

.conv-preview {
    font-size: 13px;
    color: var(--tg-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-unread {
    background: var(--tg-accent);
    color: #fff;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    flex-shrink: 0;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px 20px;
    text-align: center;
}

.empty-state p {
    font-size: 15px;
    color: var(--tg-text-secondary);
    margin-top: 16px;
}

.empty-state span {
    font-size: 12px;
    color: var(--tg-text-meta);
    margin-top: 6px;
}

/* ========================================
   CHAT AREA
   ======================================== */

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--tg-bg);
    position: relative;
    overflow: hidden;
}

.chat-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(94, 181, 247, 0.015) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.01) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.chat-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.chat-empty-content {
    text-align: center;
}

.chat-empty-content h3 {
    font-size: 18px;
    font-weight: 500;
    color: var(--tg-text-secondary);
    margin-top: 16px;
}

.chat-empty-content p {
    font-size: 13px;
    color: var(--tg-text-meta);
    margin-top: 6px;
}

/* Active Chat */
.chat-active {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    z-index: 1;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: var(--tg-header);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    min-height: 56px;
}

.back-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--tg-text);
    cursor: pointer;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: #3c7ab5;
    text-transform: uppercase;
}

.chat-header-name {
    font-size: 15px;
    font-weight: 600;
}

.chat-header-status {
    font-size: 12px;
    color: var(--tg-text-meta);
}

/* Messages */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 0 60px;
    min-height: 100%;
    justify-content: flex-end;
}

/* Date separator */
.date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
}

.date-separator span {
    background: rgba(0, 0, 0, 0.35);
    color: #c4c4c4;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 12px;
    backdrop-filter: blur(8px);
}

/* Message bubbles */
.message-row {
    display: flex;
    padding: 1px 0;
}

.message-row.incoming {
    justify-content: flex-start;
}

.message-row.outgoing,
.message-row.ai {
    justify-content: flex-end;
}

.message-bubble {
    display: inline-block;
    max-width: 420px;
    padding: 6px 8px 5px;
    border-radius: 12px;
    position: relative;
    word-break: break-word;
    line-height: 1.35;
    font-size: 14px;
}

.message-row.incoming .message-bubble {
    background: var(--tg-bubble-in);
    border-top-left-radius: 4px;
}

.message-row.outgoing .message-bubble {
    background: var(--tg-bubble-out);
    border-top-right-radius: 4px;
}

.message-row.ai .message-bubble {
    background: var(--tg-bubble-ai);
    border-top-right-radius: 4px;
    border: 1px solid rgba(139, 92, 246, 0.15);
}

.message-text {
    display: inline;
    font-size: 14px;
    white-space: pre-wrap;
}

.message-meta {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    vertical-align: bottom;
    margin-left: 8px;
    position: relative;
    top: 3px;
}


.message-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
}

.message-ai-tag {
    font-size: 9px;
    font-weight: 700;
    color: var(--tg-ai-accent);
    background: rgba(139, 92, 246, 0.15);
    padding: 1px 5px;
    border-radius: 4px;
    letter-spacing: 0.3px;
}

.message-sender {
    font-size: 13px;
    font-weight: 600;
    color: var(--tg-accent);
    margin-bottom: 1px;
}

/* ========================================
   MEDIA IN MESSAGES
   ======================================== */

/* Photos */
.message-photo {
    border-radius: 8px;
    overflow: hidden;
    margin: 2px -4px 4px;
    cursor: pointer;
    max-width: 320px;
    position: relative;
}

.message-photo img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: cover;
    transition: filter 0.15s;
}

.message-photo:hover img {
    filter: brightness(0.85);
}

/* Stickers */
.message-sticker {
    margin: 2px 0 4px;
    max-width: 200px;
}

.message-sticker img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
}

/* Documents */
.message-document {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    margin: 4px 0;
    cursor: pointer;
    transition: background 0.15s;
    min-width: 200px;
}

.message-document:hover {
    background: rgba(255, 255, 255, 0.08);
}

.doc-icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tg-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

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

.doc-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--tg-accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-size {
    font-size: 11px;
    color: var(--tg-text-meta);
    margin-top: 2px;
}

/* Voice / Audio */
.message-voice {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0;
    min-width: 240px;
}

.voice-play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--tg-accent);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}

.voice-play-btn:hover {
    filter: brightness(1.1);
}

.voice-waveform {
    flex: 1;
    height: 26px;
    display: flex;
    align-items: center;
    gap: 1px;
}

.voice-bar {
    width: 3px;
    border-radius: 2px;
    background: var(--tg-accent);
    opacity: 0.5;
    transition: opacity 0.15s;
}

.voice-duration {
    font-size: 11px;
    color: var(--tg-text-meta);
    flex-shrink: 0;
}

/* Video */
.message-video {
    border-radius: 8px;
    overflow: hidden;
    margin: 2px -4px 4px;
    max-width: 360px;
    position: relative;
    cursor: pointer;
}

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

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

.message-video:hover .video-play-overlay {
    background: rgba(0, 0, 0, 0.15);
}

.video-play-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

/* Contact */
.message-contact {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    margin: 4px 0;
}

.contact-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--tg-green);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.contact-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--tg-accent);
}

.contact-phone {
    font-size: 12px;
    color: var(--tg-text-secondary);
    margin-top: 2px;
}

/* Location */
.message-location {
    border-radius: 8px;
    overflow: hidden;
    margin: 4px 0;
    width: 280px;
    height: 160px;
}

.message-location img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Caption under media */
.message-caption {
    font-size: 14px;
    margin-top: 4px;
    line-height: 1.4;
}

/* Sticker bubble has no background */
.message-row .message-bubble.sticker-bubble {
    background: transparent !important;
    border: none !important;
    padding: 4px;
}

/* ========================================
   MESSAGE INPUT
   ======================================== */

.message-input-area {
    padding: 8px 60px 12px;
    background: var(--tg-bg);
}

.message-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--tg-input-bg);
    border-radius: 20px;
    padding: 6px 6px 6px 6px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.attach-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--tg-text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.attach-btn:hover {
    color: var(--tg-accent);
}

.message-input-wrapper textarea {
    flex: 1;
    background: none;
    border: none;
    color: var(--tg-text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    resize: none;
    max-height: 120px;
    line-height: 1.4;
    padding: 6px 0;
}

.message-input-wrapper textarea::placeholder {
    color: var(--tg-text-meta);
}

.send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--tg-accent);
    color: #fff;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.send-btn:hover {
    background: var(--tg-accent-hover);
    transform: scale(1.05);
}

.send-btn:active {
    transform: scale(0.95);
}

/* ========================================
   LIGHTBOX
   ======================================== */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

.lightbox-content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-content img {
    display: block;
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.lightbox-close {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-download {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--tg-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-decoration: none;
    transition: all 0.15s;
}

.lightbox-download:hover {
    transform: scale(1.1);
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: #323232;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    animation: toastIn 0.3s ease-out;
    max-width: 360px;
}

.toast.error {
    background: #d32f2f;
}

.toast.success {
    background: #2e7d32;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        min-width: 100%;
        position: absolute;
        z-index: 10;
        height: 100%;
    }

    .sidebar.hidden {
        display: none;
    }

    .chat-area {
        width: 100%;
    }

    .back-btn {
        display: flex;
    }

    .messages-list {
        padding: 0 12px;
    }

    .message-input-area {
        padding: 8px 12px 12px;
    }

    .message-bubble {
        max-width: 85%;
    }
}

/* ========================================
   LOADING STATES
   ======================================== */

.loading-messages {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--tg-text-meta);
    font-size: 13px;
    gap: 8px;
}

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

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tg-text-meta);
    animation: typingDot 1.4s infinite ease-in-out;
}

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

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

@keyframes typingDot {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

/* Chat AI Toggle */
.chat-ai-toggle {
    margin-left: auto;
    padding: 4px 12px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.2s;
    background: rgba(75, 205, 94, 0.15);
    color: #4dcd5e;
}

.chat-ai-toggle.ai-active {
    background: rgba(75, 205, 94, 0.15);
    color: #4dcd5e;
}

.chat-ai-toggle.ai-paused {
    background: rgba(240, 160, 60, 0.15);
    color: #f0a03c;
}

.chat-ai-toggle:hover {
    filter: brightness(1.2);
}

.ai-toggle-label {
    pointer-events: none;
}

/* Context Menu */
.context-menu {
    position: fixed;
    z-index: 1000;
    background: var(--tg-sidebar);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 4px;
    min-width: 170px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--tg-text);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
}

.context-menu-item:hover {
    background: var(--tg-sidebar-hover);
}

.context-menu-item svg {
    color: var(--tg-accent);
    flex-shrink: 0;
}

/* Pinned conversations */
.conv-pin-icon {
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
    color: var(--tg-accent);
    opacity: 0.6;
    transform: rotate(45deg);
}