/* ===== LIVE PREVIEW SECTION ===== */
.preview-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.preview-header h3 {
    margin: 0;
    font-size: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.preview-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.preview-btn {
    padding: 8px 16px;
    background: var(--primary-600);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.preview-btn:hover {
    background: var(--primary-700);
    transform: translateY(-1px);
}

.device-selector {
    padding: 8px 12px;
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.device-selector:hover {
    border-color: var(--primary-500);
}

.device-selector:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.preview-container {
    position: relative;
    background: #f0f0f0;
    border-radius: 8px;
    padding: 20px;
    min-height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.device-frame {
    width: 100%;
    height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transition: all 0.3s ease;
}

.device-frame.mobile {
    max-width: 375px;
    height: 667px;
    border-radius: 30px;
    border: 12px solid #1f1f1f;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.device-frame.tablet {
    max-width: 768px;
    height: 600px;
    border-radius: 20px;
    border: 16px solid #2f2f2f;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.device-frame.desktop {
    width: 100%;
    height: 600px;
    border-radius: 8px;
    border: 3px solid #3f3f3f;
}

#preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

.preview-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-secondary);
}

.preview-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(59, 130, 246, 0.1);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

.preview-error {
    padding: 20px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    border-radius: 8px;
    color: var(--error);
    text-align: center;
}

.preview-placeholder {
    text-align: center;
    color: var(--text-secondary);
    padding: 60px 20px;
}

.preview-placeholder i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Fullscreen mode */
.preview-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: var(--bg-primary);
    padding: 20px;
}

.preview-fullscreen .device-frame {
    width: 100%;
    height: calc(100vh - 120px);
    max-width: none;
}

.preview-fullscreen .preview-header {
    margin-bottom: 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
