/* Product Preview Modal */
.preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s;
}

.preview-overlay.active {
    display: flex;
}

.preview-modal {
    background: #fff;
    border-radius: 6px;
    width: 90%;
    max-width: 1200px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    display: flex;
    flex-direction: column;
}

.preview-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #ededed;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.preview-modal-title {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
    overflow: hidden;
}

.preview-modal-title h3 {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin: 0;
    margin-right: 35px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-modal-title .author-avatar {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    margin-right: 8px;
}

.preview-modal-title span {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
    white-space: nowrap;
}

.close-preview {
    width: 32px;
    height: 32px;
    border: none;
    background: #f3f4f6;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 16px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.close-preview:hover {
    background: #e5e7eb;
    color: #111827;
}

.btn-like-header {
    width: 32px;
    height: 32px;
    border: none;
    background: #f3f4f6;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 16px;
    transition: all 0.2s;
}

.btn-like-header:hover {
    background: #fef2f2;
    color: #ef4444;
}

.btn-like-header.liked {
    background: #fef2f2;
    color: #ef4444;
}

.btn-like-header.liked i {
    font-weight: 900;
}

.btn-share {
    width: 32px;
    height: 32px;
    border: 2px solid #e5e7eb;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-share:hover {
    border-color: #10b981;
    color: #10b981;
    background: #f0fdf4;
}

.preview-content {
    display: grid;
    grid-template-columns: 1fr 500px;
    flex: 1;
    overflow: hidden;
}

.preview-left-section {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    position: relative;
    overflow: hidden;
}

.preview-left-section::-webkit-scrollbar,
.preview-info::-webkit-scrollbar {
    width: 6px;
}

.preview-left-section::-webkit-scrollbar-track,
.preview-info::-webkit-scrollbar-track {
    background: transparent;
}

.preview-left-section::-webkit-scrollbar-thumb,
.preview-info::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

.preview-left-section::-webkit-scrollbar-thumb:hover,
.preview-info::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.preview-left-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('../images/arkaplan/lazer-desen-arka-plan.svg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
}

.preview-left-section > * {
    position: relative;
    z-index: 1;
}

.preview-gallery {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gallery-main {
    position: relative;
    aspect-ratio: 16/10;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 20px;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 12px;
    pointer-events: none;
}

.gallery-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #111827;
    font-size: 14px;
    transition: all 0.2s;
    pointer-events: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.gallery-btn:hover {
    background: #10b981;
    color: #fff;
    transform: scale(1.1);
}

.gallery-thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px;
}

.gallery-thumbs::-webkit-scrollbar {
    height: 4px;
}

.gallery-thumbs::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.gallery-thumb {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    flex-shrink: 0;
}

.gallery-thumb:hover {
    border-color: #10b981;
}

.gallery-thumb.active {
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16,185,129,0.2);
}

.preview-info {
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    background: #fafafa;
}

.preview-description {
    padding: 14px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 8px;
}

.preview-description p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #6b7280;
}

.preview-meta-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 0;
    border-top: 2px solid #e5e7eb;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 8px;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.meta-row .meta-label {
    font-size: 11px;
    color: #9ca3af;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.meta-row .meta-label i {
    font-size: 14px;
    color: #9ca3af;
    opacity: 0.8;
}

.meta-row .meta-value {
    font-size: 15px;
    color: #111827;
    font-weight: 600;
    text-align: right;
}

.preview-keywords {
    padding: 14px 0;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 8px;
}

.keywords-label {
    font-size: 11px;
    color: #9ca3af;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.keywords-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.keyword-tag {
    padding: 4px 10px;
    background: transparent;
    color: #374151;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
    border: 1.5px solid #d1d5db;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.keyword-tag::before {
    content: '#';
    color: #9ca3af;
    font-weight: 700;
}

.keyword-tag:hover {
    background: #10b981;
    color: #fff;
    border-color: #10b981;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.keyword-tag:hover::before {
    color: #fff;
}

.preview-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
}

.btn-preview-action {
    padding: 14px 20px;
    border: 2px solid #e5e7eb;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    color: #374151;
}

.btn-preview-action:hover {
    border-color: #10b981;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.btn-preview-action.primary {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border-color: #10b981;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
    border: none !important;
}

.btn-preview-action.primary:hover {
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Dark Theme */
body.dark-theme .preview-modal {
    background: #252525;
}

body.dark-theme .preview-modal-header {
    background: #252525;
    border-bottom-color: #374151;
}

body.dark-theme .preview-modal-title h3 {
    color: #f9fafb;
}

body.dark-theme .preview-modal-title span {
    color: #9ca3af;
}

body.dark-theme .close-preview {
    background: #374151;
    color: #9ca3af;
}

body.dark-theme .close-preview:hover {
    background: #4b5563;
    color: #f9fafb;
}

body.dark-theme .btn-like-header {
    background: #374151;
    color: #9ca3af;
}

body.dark-theme .btn-like-header:hover {
    background: #7f1d1d;
    color: #ef4444;
}

body.dark-theme .btn-like-header.liked {
    background: #7f1d1d;
    color: #ef4444;
}

body.dark-theme .btn-share {
    background: #374151;
    border-color: #4b5563;
    color: #9ca3af;
}

body.dark-theme .btn-share:hover {
    border-color: #10b981;
    color: #10b981;
    background: #064e3b;
}

body.dark-theme .preview-keywords {
    border-bottom-color: #374151;
}

body.dark-theme .keyword-tag {
    background: transparent;
    color: #d1d5db;
    border-color: #6b7280;
}

body.dark-theme .keyword-tag::before {
    color: #6b7280;
}

body.dark-theme .keyword-tag:hover {
    background: #10b981;
    color: #fff;
    border-color: #10b981;
}

body.dark-theme .keyword-tag:hover::before {
    color: #fff;
}

body.dark-theme .preview-left-section::before {
    opacity: 0.08;
}

body.dark-theme .gallery-main {
    background: #181818;
}

body.dark-theme .gallery-btn {
    background: rgba(24,24,24,0.9);
    color: #f9fafb;
}

body.dark-theme .gallery-btn:hover {
    background: #10b981;
}

body.dark-theme .gallery-thumb:hover,
body.dark-theme .gallery-thumb.active {
    border-color: #10b981;
}

body.dark-theme .preview-info {
    background: #2a2a2a;
}

body.dark-theme .preview-description {
    background: #181818;
}

body.dark-theme .preview-description p {
    color: #9ca3af;
}

body.dark-theme .preview-meta-list {
    border-top-color: #374151;
    border-bottom-color: #374151;
}

body.dark-theme .meta-value {
    color: #f9fafb;
}

body.dark-theme .preview-actions {
    background: #2a2a2a;
    border-top-color: #374151;
}

body.dark-theme .btn-preview-action {
    background: #181818;
    border-color: #374151;
    color: #f9fafb;
}

body.dark-theme .btn-preview-action:hover {
    border-color: #10b981;
}

body.dark-theme .btn-preview-action.primary {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border-color: #10b981;
}

body.dark-theme .preview-left-section::-webkit-scrollbar-thumb,
body.dark-theme .preview-info::-webkit-scrollbar-thumb {
    background: #4b5563;
}

body.dark-theme .preview-left-section::-webkit-scrollbar-thumb:hover,
body.dark-theme .preview-info::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Responsive */
@media (max-width: 1024px) {
    .preview-modal {
        width: 95%;
        max-width: 900px;
    }
    
    .preview-content {
        grid-template-columns: 1fr;
    }
    
    .preview-left-section {
        padding: 24px;
        max-height: 50vh;
    }
    
    .preview-info {
        padding: 24px;
        max-height: 50vh;
    }
}

@media (max-width: 768px) {
    .preview-modal {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .preview-content {
        grid-template-columns: 1fr;
        max-height: 100vh;
        overflow-y: auto;
    }
    
    .preview-left-section {
        padding: 16px;
        max-height: none;
        overflow-y: visible;
    }
    
    .preview-info {
        padding: 16px;
        max-height: none;
        overflow-y: visible;
    }
    
    .close-preview {
        position: fixed;
        top: 12px;
        right: 12px;
        z-index: 10;
    }
    
    .preview-actions {
        position: sticky;
        bottom: 0;
        background: #fafafa;
        padding: 16px 0;
        margin: 0 -16px;
        padding-left: 16px;
        padding-right: 16px;
        border-top: 1px solid #e5e7eb;
    }
    
    .preview-modal-title h3 {
        font-size: 18px;
    }
}
