/* Premium Preview Modal - Professional Scaling Architecture */

:root {
    --preview-scale: 1;
}

.preview-modal *, .preview-modal *::before, .preview-modal *::after {
    box-sizing: border-box;
}

.preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    overflow: hidden;
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
}

.preview-modal.show {
    display: block;
}

.preview-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.98);
    backdrop-filter: blur(12px);
}

.preview-modal-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Viewbar */
.preview-viewbar {
    height: 70px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    z-index: 100;
}

.preview-template-name {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.viewbar-center {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
    padding: 6px;
    border-radius: 50px;
}

.viewbar-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.viewbar-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.viewbar-btn.active {
    background: #D4AF37;
    color: #000;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.viewbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-demo-action {
    background: #D4AF37;
    color: #000 !important;
    padding: 10px 22px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-demo-action:hover {
    background: #fff;
}

.viewbar-close {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    opacity: 0.5;
    transition: 0.2s;
    padding: 8px;
}

.viewbar-close:hover {
    opacity: 1;
    transform: rotate(90deg);
}

/* Content Area */
.preview-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: #0a0a0a;
    overflow: hidden;
    position: relative;
}

/* Scaling Physics */
.preview-scaling-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(var(--preview-scale));
    transform-origin: center center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: auto;
    height: auto;
    position: relative;
    overflow: visible;
}

.iframe-wrapper {
    background: #fff;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.9);
    position: relative;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

/* Device Internal Resolutions */
.iframe-wrapper.desktop {
    width: 100%;
    height: 100%;
    border-radius: 0;
    box-shadow: none;
}

.iframe-wrapper.tablet {
    width: 768px;
    height: 1024px;
    border: 12px solid #1a1a1a;
    border-radius: 32px;
    display: flex;
}

.iframe-wrapper.mobile {
    width: 430px; /* Maxi-Phone standard for better layout stability */
    height: 880px;
    border: 12px solid #1a1a1a;
    border-radius: 44px;
    display: flex;
}

#previewIframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
    display: block;
    overflow-x: hidden !important;
}

/* Hide scrollbar track for a cleaner premium look */
#previewIframe::-webkit-scrollbar {
    width: 5px;
    height: 0;
}
#previewIframe::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
}

/* Animation */
@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.preview-modal.show .preview-modal-container {
    animation: modalIn 0.4s ease forwards;
}

@media (max-width: 768px) {
    .preview-viewbar {
        padding: 0 15px;
        height: auto;
        padding-top: 15px;
        padding-bottom: 15px;
        flex-direction: column;
        gap: 12px;
    }
    
    .viewbar-left { order: 1; }
    .viewbar-center { order: 2; }
    .viewbar-right { order: 3; }
}
