/* ═══════════════════════════════════════════
   Zalo Chat Embed - Dark Theme Premium
   ═══════════════════════════════════════════ */

/* ─── Design Tokens ─── */
:root {
    /* Colors - Deep Space Theme */
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-tertiary: #1a2035;
    --bg-surface: #1e2642;
    --bg-hover: #252d48;
    --bg-active: #2a3556;

    /* Accent */
    --accent-primary: #3b82f6;
    --accent-secondary: #06b6d4;
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    --accent-glow: 0 0 20px rgba(59, 130, 246, 0.3);

    /* Text */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --text-inverse: #0f172a;

    /* Chat Bubbles */
    --bubble-sent: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --bubble-received: #1e293b;

    /* Status */
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Borders */
    --border-subtle: rgba(148, 163, 184, 0.1);
    --border-medium: rgba(148, 163, 184, 0.15);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(59, 130, 246, 0.15);

    /* Layout */
    --sidebar-width: 360px;
    --header-height: 64px;
    --input-height: 64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 50%;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Reset & Base ─── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    height: 100%;
    width: 100%;
    position: relative;
}

/* ─── Screens ─── */
.screen {
    display: none;
    height: 100%;
    width: 100%;
}

.screen.active {
    display: flex;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
    width: 6px;
}

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

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

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

/* ═══════════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════════ */
.login-container {
    margin: auto;
    text-align: center;
    padding: 40px;
    max-width: 440px;
    width: 100%;
    animation: fadeInUp 0.6s ease-out;
}

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

.login-logo {
    margin-bottom: 32px;
}

.logo-icon {
    display: inline-flex;
    margin-bottom: 16px;
    filter: drop-shadow(var(--accent-glow));
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.3)); }
    50% { filter: drop-shadow(0 0 25px rgba(59, 130, 246, 0.5)); }
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 8px;
}

.qr-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    transition: var(--transition-normal);
}

.qr-container.has-qr {
    background: white;
    padding: 16px;
}

.qr-container img {
    max-width: 100%;
    border-radius: var(--radius-sm);
}

.qr-placeholder {
    text-align: center;
    color: var(--text-tertiary);
}

.qr-placeholder p {
    margin-top: 12px;
    font-size: 13px;
}

/* Spinner */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-medium);
    border-top-color: var(--accent-primary);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

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

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Primary Button */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--accent-glow), var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    font-size: 18px;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 24px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-family);
    cursor: pointer;
    transition: var(--transition-normal);
    margin-top: 12px;
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.login-hint {
    color: var(--text-tertiary);
    font-size: 12px;
    margin-top: 16px;
}

/* ═══════════════════════════════════════════
   CHAT SCREEN LAYOUT
   ═══════════════════════════════════════════ */
#chat-screen {
    flex-direction: row;
}

/* ─── Sidebar ─── */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100%;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
}

.sidebar-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.account-selector-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.account-select {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 6px 10px;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    transition: var(--transition-fast);
}

.account-select:focus {
    border-color: var(--accent-primary);
}

.icon-btn.success:hover {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
    color: white;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.user-details {
    min-width: 0;
}

.user-details h2 {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
}

.status-badge.connected {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.status-badge.disconnected {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

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

/* Icon Button */
.icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.icon-btn.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Search */
.search-container {
    padding: 12px 16px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-input-wrapper input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-family);
    outline: none;
    transition: var(--transition-fast);
}

.search-input-wrapper input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-input-wrapper input::placeholder {
    color: var(--text-tertiary);
}

/* ─── Conversation List ─── */
.conversation-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
}

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

.conversation-item.active {
    background: var(--bg-active);
}

.conversation-item .conv-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
    flex-shrink: 0;
    color: var(--accent-primary);
}

.conversation-item .conv-avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    object-fit: cover;
}

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

.conv-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}

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

.conv-time {
    font-size: 11px;
    color: var(--text-tertiary);
    white-space: nowrap;
    margin-left: 8px;
}

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

.conv-unread {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--accent-primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 4px;
}

.empty-state small {
    font-size: 12px;
}

/* ─── Chat Main Area ─── */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

/* Empty Chat State */
.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px;
}

.chat-empty h3 {
    font-size: 20px;
    font-weight: 600;
    margin-top: 16px;
    color: var(--text-secondary);
}

.chat-empty p {
    color: var(--text-tertiary);
    font-size: 14px;
    margin-top: 8px;
    max-width: 300px;
}

/* Active Chat */
.chat-active {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Chat Header */
.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    min-height: var(--header-height);
}

.back-btn {
    display: none;
}

.chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
    color: var(--accent-primary);
}

.chat-header-avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    object-fit: cover;
}

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

.chat-header-info h3 {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

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

/* ─── Messages Area ─── */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.messages-loading {
    display: flex;
    justify-content: center;
    padding: 20px;
}

/* Message Bubbles */
.message-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
}

.message-group.sent {
    align-items: flex-end;
}

.message-group.received {
    align-items: flex-start;
}

.message-sender {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 4px;
    padding-left: 4px;
}

.message-bubble {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
    animation: msgAppear 0.2s ease-out;
    white-space: pre-wrap;
}

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

.message-group.sent .message-bubble {
    background: var(--bubble-sent);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-group.received .message-bubble {
    background: var(--bubble-received);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 4px;
    padding: 0 4px;
}

.message-group.sent .message-time {
    text-align: right;
    color: rgba(255, 255, 255, 0.5);
}

/* Date Separator */
.date-separator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    color: var(--text-tertiary);
    font-size: 12px;
}

.date-separator::before,
.date-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-subtle);
}

/* ─── Chat Input ─── */
.chat-input-area {
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-subtle);
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 4px 4px 4px 16px;
    transition: var(--transition-fast);
}

.chat-input-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.chat-input-wrapper textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-family);
    resize: none;
    outline: none;
    padding: 8px 0;
    max-height: 120px;
    line-height: 1.5;
}

.chat-input-wrapper textarea::placeholder {
    color: var(--text-tertiary);
}

.btn-send {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.btn-send:hover {
    transform: scale(1.05);
    box-shadow: var(--accent-glow);
}

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

/* ═══════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 480px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-body input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-family);
    outline: none;
    margin-bottom: 12px;
    transition: var(--transition-fast);
}

.modal-body input:focus {
    border-color: var(--accent-primary);
}

.modal-body input::placeholder {
    color: var(--text-tertiary);
}

.contact-results {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.contact-item:hover {
    background: var(--bg-hover);
}

.contact-item .contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--accent-secondary);
    flex-shrink: 0;
}

.contact-item .contact-avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    object-fit: cover;
}

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

.contact-item .contact-name {
    font-size: 14px;
    font-weight: 500;
}

.contact-item .contact-phone {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* ═══════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════ */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease-out;
    max-width: 360px;
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--danger);
}

.toast.info {
    border-left: 3px solid var(--accent-primary);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 100%;
    }

    #chat-screen {
        position: relative;
    }

    .sidebar {
        position: absolute;
        inset: 0;
        z-index: 10;
        width: 100%;
        transition: var(--transition-normal);
    }

    .sidebar.hidden {
        transform: translateX(-100%);
    }

    .chat-main {
        position: absolute;
        inset: 0;
        z-index: 5;
    }

    .back-btn {
        display: flex !important;
    }

    .chat-empty {
        display: none;
    }

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

@media (max-width: 480px) {
    .sidebar-header {
        padding: 12px 16px;
    }

    .chat-messages {
        padding: 12px;
    }

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

/* Image Preview Container */
.image-preview-container {
    display: flex;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-subtle);
    overflow-x: auto;
}

.preview-item {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--border-medium);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
}

.preview-remove:hover {
    background: var(--danger);
}

/* Image Messages */
.message-bubble.image-message {
    padding: 0;
    background: transparent !important;
    max-width: 250px;
    cursor: zoom-in;
    overflow: hidden;
    border-radius: var(--radius-md);
}

.message-bubble.image-message img {
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: cover;
    border-radius: var(--radius-md);
    display: block;
    transition: var(--transition-fast);
    border: 1px solid var(--border-subtle);
}

.message-bubble.image-message img:hover {
    opacity: 0.9;
}

/* Lightbox Modal */
.lightbox-modal .modal-overlay {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.lightbox-content {
    max-width: 90%;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    animation: zoomIn 0.2s ease-out;
}

@keyframes zoomIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    z-index: 1002;
    padding: 8px;
    border-radius: var(--radius-full);
    transition: var(--transition-fast);
}

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

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.05);
    border: none;
    color: white;
    padding: 16px 8px;
    cursor: pointer;
    z-index: 1002;
    transition: var(--transition-fast);
    border-radius: var(--radius-sm);
}

.lightbox-nav:hover {
    background: rgba(255,255,255,0.15);
}

.lightbox-nav.prev {
    left: 20px;
}

.lightbox-nav.next {
    right: 20px;
}

/* Sender Name and Group Tags */
.message-sender {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 3px;
    margin-left: 12px;
}

.group-tag {
    display: inline-flex;
    align-items: center;
    background: rgba(37, 99, 235, 0.2);
    color: #60a5fa;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    margin-right: 4px;
    font-weight: 600;
    border: 1px solid rgba(37, 99, 235, 0.3);
}

/* Album Grid Layout */
.message-bubble.album-message {
    padding: 4px;
    background: rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-subtle);
    max-width: 320px;
    border-radius: var(--radius-md);
    display: grid;
    gap: 4px;
    cursor: pointer;
    overflow: hidden;
}

.album-img-wrapper {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 1;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.album-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: var(--transition-fast);
}

.album-img-wrapper img:hover {
    transform: scale(1.05);
}

/* Album Grids */
.album-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.album-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.album-grid-4 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

/* More Overlay */
.album-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
