/* ========================================
   IMAGE PREVIEW MODAL
   Facebook Messenger-inspired design
   Matches chat-dropdown.css style
   For multi-image selection before upload
   ======================================== */

/* Modal Container */
#multi-image-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
}

#multi-image-preview-modal.show {
    opacity: 1;
    visibility: visible;
}

/* Overlay with blur effect */
#multi-image-preview-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: -1;
}

/* Modal Dialog */
/* Modal Dialog - Scoped to image preview only */
#multi-image-preview-modal .modal-dialog {
    width: 100%;
    max-width: 600px;
    margin: 0;
    z-index: 1;
}

/* Modal Content - Matches dropdown style */
#multi-image-preview-modal .modal-content {
    background: var(--bg-color-3);
    border-radius: 18px; /* Match dropdown */
    padding: 0;
    box-shadow: 
        0 12px 32px rgba(0, 0, 0, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.08),
        0 0 0 2px rgba(0, 0, 0, 0.1);
    border: none;
    transform: scale(0.94) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@supports (backdrop-filter: blur(12px)) {
    #multi-image-preview-modal .modal-content {
        backdrop-filter: blur(12px) saturate(180%);
        background: rgba(var(--bg-color-3-rgb, 36, 39, 43), 0.94);
    }
}

#multi-image-preview-modal.show .modal-content {
    transform: scale(1) translateY(0);
}

/* Header */
#multi-image-preview-modal .modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: none;
}

#multi-image-preview-modal .modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-1);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

#multi-image-preview-modal .modal-title i {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(74, 158, 255, 0.15);
    color: #4A9EFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

/* Close Button - Minimalist */
#multi-image-preview-modal .close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--color-text-2);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.18s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    padding: 0;
    margin: 0;
}

#multi-image-preview-modal .close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--color-text-1);
    transform: scale(1.1);
}

#multi-image-preview-modal .close:active {
    transform: scale(0.95);
}

/* Body */
#multi-image-preview-modal .modal-body {
    padding: 16px 24px;
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Custom scrollbar for Webkit */
#multi-image-preview-modal .modal-body::-webkit-scrollbar {
    width: 8px;
}

#multi-image-preview-modal .modal-body::-webkit-scrollbar-track {
    background: transparent;
}

#multi-image-preview-modal .modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

#multi-image-preview-modal .modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Image Preview Item - Card style */
.image-preview-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    transition: all 0.18s ease;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.image-preview-item:last-child {
    margin-bottom: 0;
}

.image-preview-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(74, 158, 255, 0.3);
    transform: translateX(2px);
}

/* Image Thumbnail */
.image-preview-item img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid rgba(74, 158, 255, 0.4);
    flex-shrink: 0;
}

/* Image Info */
.image-preview-item > div {
    flex: 1;
    min-width: 0;
}

.image-preview-item > div > div:first-child {
    font-weight: 500;
    font-size: 14px;
    color: var(--color-text-1);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-preview-item > div > div:last-child {
    font-size: 12px;
    color: var(--color-text-2);
    opacity: 0.8;
}

/* Remove Button */
.image-preview-item button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(231, 76, 60, 0.15);
    border: none;
    color: #e74c3c;
    cursor: pointer;
    transition: all 0.18s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.image-preview-item button:hover {
    background: rgba(231, 76, 60, 0.25);
    transform: scale(1.1);
}

.image-preview-item button:active {
    transform: scale(0.95);
}

/* Footer */
#multi-image-preview-modal .modal-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    gap: 10px;
    background: none;
    justify-content: flex-end;
}

/* Buttons - Match dropdown style */
#multi-image-preview-modal .btn {
    padding: 11px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

#multi-image-preview-modal .btn:active {
    transform: scale(0.98);
}

/* Cancel Button */
#multi-image-preview-modal .btn-secondary {
    background: rgba(var(--accent-2-rgb, 75, 142, 242), 0.12);
    color: var(--color-text-1);
}

#multi-image-preview-modal .btn-secondary:hover {
    background: rgba(var(--accent-2-rgb, 75, 142, 242), 0.18);
    transform: translateY(-1px);
}

/* Upload Button - Primary */
#multi-image-preview-modal .bg-accent-3 {
    background: linear-gradient(135deg, var(--accent-2) 0%, #3a7bc8 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(74, 158, 255, 0.3);
}

#multi-image-preview-modal .bg-accent-3:hover {
    background: linear-gradient(135deg, #3a7bc8 0%, #2e5fa3 100%);
    box-shadow: 0 6px 16px rgba(74, 158, 255, 0.4);
    transform: translateY(-2px);
}

/* Ripple effect */
#multi-image-preview-modal .btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
    pointer-events: none;
    opacity: 0;
}

#multi-image-preview-modal .btn:active::before {
    width: 200px;
    height: 200px;
    opacity: 1;
    transition: width 0s, height 0s, opacity 0.3s ease;
}

/* ==================== 
   LIGHT THEME 
   ==================== */

html[data-theme="light"] #multi-image-preview-modal .modal-content {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 
        0 12px 32px rgba(0, 0, 0, 0.15),
        0 4px 12px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(0, 0, 0, 0.05);
}

@supports (backdrop-filter: blur(12px)) {
    html[data-theme="light"] #multi-image-preview-modal .modal-content {
        backdrop-filter: blur(12px) saturate(180%);
        background: rgba(255, 255, 255, 0.96);
    }
}

html[data-theme="light"] #multi-image-preview-modal .modal-header,
html[data-theme="light"] #multi-image-preview-modal .modal-footer {
    border-color: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] #multi-image-preview-modal .modal-title {
    color: #1c1e21;
}

html[data-theme="light"] #multi-image-preview-modal .modal-title i {
    background: rgba(74, 158, 255, 0.12);
    color: #1877F2;
}

html[data-theme="light"] #multi-image-preview-modal .close {
    background: rgba(0, 0, 0, 0.05);
    color: #4b5563;
}

html[data-theme="light"] #multi-image-preview-modal .close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #1c1e21;
}

html[data-theme="light"] .image-preview-item {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .image-preview-item:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(74, 158, 255, 0.3);
}

html[data-theme="light"] .image-preview-item > div > div:first-child {
    color: #1c1e21;
}

html[data-theme="light"] .image-preview-item > div > div:last-child {
    color: #4b5563;
}

html[data-theme="light"] #multi-image-preview-modal .btn-secondary {
    background: rgba(74, 158, 255, 0.08);
    color: #1c1e21;
}

html[data-theme="light"] #multi-image-preview-modal .btn-secondary:hover {
    background: rgba(74, 158, 255, 0.12);
}

html[data-theme="light"] #multi-image-preview-modal .bg-accent-3 {
    background: linear-gradient(135deg, #4A9EFF 0%, #1877F2 100%);
    box-shadow: 0 4px 12px rgba(74, 158, 255, 0.25);
}

html[data-theme="light"] #multi-image-preview-modal .bg-accent-3:hover {
    background: linear-gradient(135deg, #1877F2 0%, #0C65E8 100%);
    box-shadow: 0 6px 16px rgba(74, 158, 255, 0.35);
}

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

@media (max-width: 576px) {
    #multi-image-preview-modal {
        padding: 10px;
    }
    
    #multi-image-preview-modal .modal-dialog {
        max-width: 100%;
    }
    
    #multi-image-preview-modal .modal-header {
        padding: 16px 18px;
    }
    
    #multi-image-preview-modal .modal-title {
        font-size: 16px;
    }
    
    #multi-image-preview-modal .modal-body {
        padding: 12px 18px;
        max-height: 300px;
    }
    
    .image-preview-item {
        padding: 10px;
    }
    
    .image-preview-item img {
        width: 64px;
        height: 64px;
    }
    
    #multi-image-preview-modal .modal-footer {
        padding: 12px 18px;
        flex-direction: column-reverse;
    }
    
    #multi-image-preview-modal .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ==================== 
   ACCESSIBILITY 
   ==================== */

@media (prefers-reduced-motion: reduce) {
    #multi-image-preview-modal,
    #multi-image-preview-modal .modal-content,
    #multi-image-preview-modal .btn {
        transition: none;
        animation: none;
    }
}

