/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #0f0f0f;
    color: #ffffff;
    overflow: hidden;
    height: 100vh;
}

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
    background: #1a1a1a;
}

/* Sidebar Left - Channel List */
.sidebar-left {
    width: 300px;
    background: #1f1f1f;
    border-right: 1px solid #2a2a2a;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.channel-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.channel-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-radius: 10px;
    color: #a0a0a0;
    text-decoration: none;
    transition: all 0.2s;
    margin-bottom: 5px;
}

.channel-item:hover {
    background: #2a2a2a;
    color: #fff;
    text-decoration: none;
}

.channel-item.active {
    background: #2a2a2a;
    color: #fff;
}

.channel-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #3a3a3a;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
}

.channel-info {
    flex: 1;
}

.channel-name {
    font-weight: 500;
    margin-bottom: 2px;
}

.channel-preview {
    font-size: 12px;
    color: #808080;
}

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid #2a2a2a;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.user-name {
    flex: 1;
    font-weight: 500;
}

/* Main Chat Area */
.main-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
    position: relative;
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1f1f1f;
}

.channel-title h2 {
    margin: 0;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.channel-description {
    margin: 5px 0 0;
    font-size: 14px;
    color: #a0a0a0;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Messages */
.message {
    display: flex;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-own {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.message-content {
    max-width: 70%;
}

.message-own .message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.message-author {
    font-weight: 500;
    color: #fff;
}

.message-time {
    font-size: 12px;
    color: #808080;
}

.message-text {
    background: #2a2a2a;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
}

.message-own .message-text {
    background: #0084ff;
    color: #fff;
}

.message-media {
    max-width: 400px;
    border-radius: 12px;
    overflow: hidden;
}

.message-media img,
.message-media video {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
}

.message-footer {
    margin-top: 5px;
}

.btn-like {
    background: none;
    border: none;
    color: #808080;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 20px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-like:hover {
    background: #3a3a3a;
    color: #ff4757;
}

.btn-like.liked {
    color: #ff4757;
}

.btn-like:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   CHAT INPUT AREA - IMPROVED DESIGN
   ============================================ */

.chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid #2a2a2a;
    background: #1f1f1f;
    flex-shrink: 0;
}

/* Input group container */
.chat-input-container {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: #2a2a2a;
    border-radius: 24px;
    padding: 8px 12px;
    border: 1px solid #3a3a3a;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input-container:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Attachment buttons */
.attachment-buttons {
    display: flex;
    gap: 4px;
    align-items: center;
}

.btn-attach {
    background: transparent;
    border: none;
    color: #a0a0a0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 18px;
}

.btn-attach:hover {
    background: #3a3a3a;
    color: #fff;
}

.btn-attach.image-btn:hover {
    color: #4CAF50;
}

.btn-attach.file-btn:hover {
    color: #2196F3;
}

.btn-attach.emoji-btn:hover {
    color: #FFC107;
}

/* Message input */
#messageInput {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 15px;
    line-height: 1.5;
    padding: 10px 0;
    resize: none;
    min-height: 24px;
    max-height: 120px;
    overflow-y: auto;
    font-family: inherit;
}

#messageInput::placeholder {
    color: #6c757d;
    font-size: 14px;
}

#messageInput:focus {
    outline: none;
}

#messageInput:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Custom scrollbar for textarea */
#messageInput::-webkit-scrollbar {
    width: 4px;
}

#messageInput::-webkit-scrollbar-track {
    background: transparent;
}

#messageInput::-webkit-scrollbar-thumb {
    background: #4a4a4a;
    border-radius: 2px;
}

/* Send button */
.btn-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    flex-shrink: 0;
}

.btn-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-send:active {
    transform: scale(0.95);
}

.btn-send:disabled {
    opacity: 0.5;
    transform: none;
    box-shadow: none;
    cursor: not-allowed;
}

.btn-send i {
    margin-left: 2px;
}

/* Guest message */
.guest-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #2a2a2a 0%, #1f1f1f 100%);
    border-radius: 24px;
    border: 1px solid #3a3a3a;
}

.guest-message-content {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #a0a0a0;
}

.guest-message i {
    font-size: 20px;
    color: #667eea;
}

.guest-message span {
    font-size: 15px;
}

.guest-message .btn-login {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.guest-message .btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    color: white;
    text-decoration: none;
}

/* Upload progress area */
.upload-progress-area {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.upload-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #2a2a2a;
    border-radius: 12px;
    border: 1px solid #3a3a3a;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.upload-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.upload-icon.image {
    background: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
}

.upload-icon.video {
    background: rgba(33, 150, 243, 0.1);
    color: #2196F3;
}

.upload-icon.file {
    background: rgba(255, 193, 7, 0.1);
    color: #FFC107;
}

.upload-info {
    flex: 1;
    min-width: 0;
}

.upload-filename {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.upload-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.upload-size {
    font-size: 12px;
    color: #a0a0a0;
}

.upload-progress-wrapper {
    flex: 1;
    max-width: 200px;
}

.upload-progress {
    height: 6px;
    background: #3a3a3a;
    border-radius: 3px;
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px;
    transition: width 0.3s;
    position: relative;
    overflow: hidden;
}

.upload-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.upload-status {
    font-size: 12px;
    color: #a0a0a0;
    min-width: 45px;
    text-align: right;
}

.upload-actions {
    display: flex;
    gap: 4px;
}

.btn-upload-cancel {
    background: transparent;
    border: none;
    color: #a0a0a0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.btn-upload-cancel:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

/* Typing indicator */
.typing-indicator {
    padding: 8px 20px;
    color: #a0a0a0;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: fadeIn 0.3s ease;
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dots span {
    width: 5px;
    height: 5px;
    background: #a0a0a0;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

/* Slow mode indicator */
.slow-mode-indicator {
    padding: 8px 20px;
    background: rgba(255, 193, 7, 0.1);
    color: #FFC107;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 193, 7, 0.2);
}

.slow-mode-indicator i {
    font-size: 14px;
}

/* Responsive */
@media (max-width: 767px) {
    .chat-input-area {
        padding: 12px;
    }
    
    .chat-input-container {
        padding: 6px 8px;
        gap: 6px;
    }
    
    .btn-attach {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .btn-send {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    #messageInput {
        font-size: 14px;
        padding: 8px 0;
    }
    
    .guest-message {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .upload-item {
        padding: 10px 12px;
    }
    
    .upload-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

@media (max-width: 575px) {
    .attachment-buttons {
        display: none;
    }
    
    .upload-meta {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .upload-progress-wrapper {
        max-width: 100%;
        width: 100%;
    }
}

/* Sidebar Right - Channel Info */
.sidebar-right {
    width: 300px;
    background: #1f1f1f;
    border-left: 1px solid #2a2a2a;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s;
}

.info-header {
    padding: 20px;
    border-bottom: 1px solid #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.info-header h4 {
    margin: 0;
    font-size: 18px;
}

.info-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.info-section {
    margin-bottom: 30px;
}

.info-section h5 {
    font-size: 14px;
    text-transform: uppercase;
    color: #a0a0a0;
    margin-bottom: 15px;
}

.member-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.member-name {
    font-size: 14px;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
}

.media-item {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 5px;
    cursor: pointer;
}

.media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.media-item:hover img {
    transform: scale(1.05);
}

/* Loading */
.messages-loading {
    text-align: center;
    padding: 20px;
}

/* Modal */
.modal-content {
    background: #1f1f1f;
    color: #fff;
}

.modal-body {
    padding: 0;
}

#viewerImage {
    width: 100%;
    height: auto;
}

/* Message Highlight */
.message-new {
    animation: highlight 1s ease;
}

@keyframes highlight {
    0% {
        background: rgba(0, 132, 255, 0.3);
    }
    100% {
        background: transparent;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #3a3a3a;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4a4a4a;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar-left {
        position: absolute;
        left: -300px;
        top: 0;
        bottom: 0;
        z-index: 100;
        transition: left 0.3s;
    }
    
    .sidebar-left.active {
        left: 0;
    }
    
    .sidebar-right {
        position: absolute;
        right: -300px;
        top: 0;
        bottom: 0;
        z-index: 100;
    }
    
    .sidebar-right.active {
        right: 0;
    }
    
    .message-content {
        max-width: 85%;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.message-own {
    animation: slideIn 0.3s ease;
}
/* Upload Area */
.upload-area {
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    max-height: 200px;
    overflow-y: auto;
}

.upload-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-xs);
}

.upload-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    min-width: 0;
}

.upload-info i {
    font-size: 1.25rem;
    color: var(--primary);
}

.upload-filename {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.upload-status {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.upload-item .progress {
    width: 100px;
    height: 6px;
}
.btn-icon {
    color: white;
}

.btn-cancel-upload {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.btn-cancel-upload:hover {
    background: var(--bg-hover);
    color: var(--danger);
}
/* Nút mobile menu toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s;
}

.mobile-menu-toggle:hover {
    background: #2a2a2a;
}

/* Hiển thị nút trên mobile */
@media (max-width: 991px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .chat-header {
        padding: 12px 15px;
    }
    
    .channel-title h2 {
        font-size: 18px;
    }
}

/* Sidebar overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Sidebar trên mobile */
@media (max-width: 991px) {
    .sidebar-left {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 100;
        box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    }
    
    .sidebar-left.active {
        transform: translateX(0);
    }
    
    .sidebar-right {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        z-index: 100;
        box-shadow: -2px 0 10px rgba(0,0,0,0.3);
    }
    
    .sidebar-right.active {
        transform: translateX(0);
    }
}
/* ============================================
   MESSAGE BACKGROUND CUSTOMIZATION
   ============================================ */

/* Biến CSS cho nền tin nhắn */
:root {
    --msg-bg-other: #2a2a2a;
    --msg-bg-own: #0084ff;
    --msg-text-other: #ffffff;
    --msg-text-own: #ffffff;
}

/* Nền tin nhắn của người khác */
.message:not(.message-own) .message-text {
    background: var(--msg-bg-other);
    color: var(--msg-text-other);
}

/* Nền tin nhắn của chính mình */
.message-own .message-text {
    background: var(--msg-bg-own);
    color: var(--msg-text-own);
}

/* Theme selector - nút chọn màu nền */
.message-theme-selector {
    position: fixed;
    bottom: 100px;
    right: 20px;
    z-index: 1000;
}

.theme-toggle-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle-btn:hover {
    transform: scale(1.1);
}

.theme-panel {
    position: absolute;
    bottom: 60px;
    right: 0;
    background: #1f1f1f;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    border: 1px solid #2a2a2a;
    min-width: 280px;
    display: none;
}

.theme-panel.active {
    display: block;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.theme-panel h4 {
    color: #fff;
    font-size: 14px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #2a2a2a;
}

.theme-panel h4 i {
    margin-right: 8px;
    color: #667eea;
}

.theme-section {
    margin-bottom: 16px;
}

.theme-section label {
    color: #a0a0a0;
    font-size: 12px;
    margin-bottom: 8px;
    display: block;
}

.color-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-option {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.active {
    border-color: #fff;
    box-shadow: 0 0 0 2px #667eea;
}

.color-option.active::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: white;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Các màu preset */
.color-blue { background: #0084ff; }
.color-green { background: #00b894; }
.color-purple { background: #6c5ce7; }
.color-red { background: #e74c3c; }
.color-orange { background: #e67e22; }
.color-pink { background: #fd79a8; }
.color-dark { background: #2d3436; }
.color-teal { background: #00cec9; }

/* Nền tối cho tin nhắn người khác */
.bg-dark-msg { background: #1a1a1a; }
.bg-gray-msg { background: #2a2a2a; }
.bg-gradient-1 { background: linear-gradient(135deg, #2d3436 0%, #000000 100%); }
.bg-gradient-2 { background: linear-gradient(135deg, #1e272e 0%, #485460 100%); }

/* ============================================
   MEDIA VIEWER - LIGHTBOX CHUYÊN NGHIỆP
   ============================================ */

.media-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.media-viewer-overlay.active {
    display: flex;
}

.media-viewer-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-viewer-content {
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-viewer-content img,
.media-viewer-content video {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* Video controls custom */
.media-viewer-content video {
    outline: none;
}

.media-viewer-content video::-webkit-media-controls {
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
}

.media-viewer-content video::-webkit-media-controls-panel {
    padding: 0 10px;
}

/* Viewer controls */
.media-viewer-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 12px;
    z-index: 10000;
}

.media-viewer-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.media-viewer-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.media-viewer-close {
    background: rgba(220, 53, 69, 0.8);
}

.media-viewer-close:hover {
    background: #dc3545;
}

/* Navigation buttons */
.media-viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10000;
}

.media-viewer-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.05);
}

.media-viewer-prev {
    left: 20px;
}

.media-viewer-next {
    right: 20px;
}

.media-viewer-nav.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.media-viewer-nav.disabled:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: translateY(-50%);
}

/* Viewer info bar */
.media-viewer-info {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
    font-size: 14px;
    z-index: 10000;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 40px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.media-viewer-counter {
    color: #a0a0a0;
}

.media-viewer-filename {
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-viewer-actions {
    display: flex;
    gap: 16px;
}

.media-viewer-action {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    transition: all 0.2s;
}

.media-viewer-action:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Loading spinner */
.media-viewer-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.media-viewer-loading .spinner-border {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

/* Zoom controls */
.media-viewer-zoom {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 40px;
    z-index: 10000;
}

.media-viewer-zoom-btn {
    background: none;
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
}

.media-viewer-zoom-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Responsive */
@media (max-width: 767px) {
    .media-viewer-nav {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .media-viewer-prev {
        left: 10px;
    }
    
    .media-viewer-next {
        right: 10px;
    }
    
    .media-viewer-info {
        padding: 10px 16px;
        font-size: 12px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .media-viewer-filename {
        max-width: 150px;
    }
    
    .media-viewer-zoom {
        bottom: 100px;
    }
    
    .theme-panel {
        min-width: 260px;
        right: 0;
    }
}

@media (max-width: 575px) {
    .media-viewer-controls {
        top: 10px;
        right: 10px;
    }
    
    .media-viewer-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .media-viewer-filename {
        display: none;
    }
}
/* Ngăn video trong viewer ẩn vẫn phát */
.media-viewer-overlay:not(.active) video,
.media-viewer-overlay:not(.active) audio {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Video trong viewer */
.media-viewer-content video {
    display: block;
    margin: 0 auto;
    background: #000;
}

/* Loading spinner */
.media-viewer-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    text-align: center;
    z-index: 10;
}

.media-viewer-loading .spinner-border {
    width: 48px;
    height: 48px;
    border-width: 3px;
    margin-bottom: 16px;
}